Skip to content

Commit

Permalink
added goreleaser
Browse files Browse the repository at this point in the history
  • Loading branch information
Simple-MAX committed Sep 27, 2022
1 parent 4cabce2 commit f6442b7
Show file tree
Hide file tree
Showing 4 changed files with 90 additions and 23 deletions.
47 changes: 28 additions & 19 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -1,26 +1,35 @@
name: release
on:
release:
types: [created]
push:
tags:
- v*

env:
GO_VERSION: 1.19

jobs:
releases-matrix:
name: Release Go Binary
release:
name: release
runs-on: ubuntu-latest
strategy:
matrix:
# build and publish in parallel: linux/386, linux/amd64, linux/arm64, windows/386, windows/amd64, darwin/amd64, darwin/arm64
goos: [linux, windows, darwin]
goarch: ["386", amd64, arm64]
exclude:
- goarch: "386"
goos: darwin
- goarch: arm64
goos: windows
steps:
- uses: actions/checkout@v3
- uses: wangyoucao577/[email protected]
with:
goos: ${{ matrix.goos }}
goarch: ${{ matrix.goarch }}
project_path: "./cmd/main"
binary_name: "ProtoPort"
fetch-depth: 0
- uses: actions/setup-go@v3
with:
go-version: ${{ env.GO_VERSION }}
check-latest: true
- uses: actions/cache@v3
if: ${{ !env.ACT }}
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: GoReleaser
uses: goreleaser/goreleaser-action@v3
with:
version: latest
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GORELEASER_GITHUB_TOKEN }}
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,5 @@

.vscode
test
main.exe
main.exe
dist/
57 changes: 57 additions & 0 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# This is an example .goreleaser.yml file with some sensible defaults.
# Make sure to check the documentation at https://goreleaser.com
before:
hooks:
# You may remove this if you don't use go modules.
- go mod tidy
builds:
- main: ./cmd/proto-port/main.go
env:
- CGO_ENABLED=0
goos:
- linux
- windows
- darwin
goarch:
- amd64
- "386"
- arm
- arm64
goarm:
- "6"
- "7"
ignore:
- goos: windows
goarch: "6"
archives:
- name_template: "{{ .ProjectName }}_{{ .Os }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}{{ if .Mips }}_{{ .Mips }}{{ end }}"
replacements:
darwin: Darwin
linux: Linux
windows: Windows
386: i386
amd64: x86_64
format_overrides:
- goos: windows
format: zip
checksum:
name_template: "checksums.txt"
changelog:
groups:
- title: "New Features"
regexp: "^.*feat[(\\w)]*:+.*$"
order: 0
- title: "Bug fixes"
regexp: "^.*fix[(\\w)]*:+.*$"
order: 1
- title: "Documentation updates"
regexp: "^.*docs[(\\w)]*:+.*$"
order: 2
- title: "Other"
order: 999
release:
prerelease: auto
mode: append
# modelines, feel free to remove those if you don't want/use them:
# yaml-language-server: $schema=https://goreleaser.com/static/schema.json
# vim: set ts=2 sw=2 tw=0 fo=cnqoj
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ For more information visit [grpc.io](https://grpc.io/)

## Usage

```
```bash
ProtoPort [command] [options]
```

Expand All @@ -54,7 +54,7 @@ ProtoPort [command] [options]
| -------- | ----------------------------------------------------------------------------------------------------------------------------------------- |
| -inputs | Path to proto files (if path not specified, it will scan current folder for proto files and generate them with the same folder structure) |
| -outputs | Path to output files (if not specified, it will store the file in the current folder and it will preserve the input folder structure) |
| -lang | Choose language to generate \*(required)[go, cpp, csharp, java, kotlin, objc, php, python, pyi, ruby, dart, node] |
| -lang | Choose language to generate \*[required](go, cpp, csharp, java, kotlin, objc, php, python, pyi, ruby, dart, node) |

#### GitHub options

Expand All @@ -63,7 +63,7 @@ ProtoPort [command] [options]
| -inputs | The url to the GitHub repo (if path not specified, it will scan the whole repo for proto files and generate them with the same folder structure) |
| -outputs | Path to output files (if not specified, it will store the file in the current folder and it will preserve the input folder structure) |
| -pat | GitHub Personal Access Token (only needed if repo is private) |
| -lang | Choose language to generate \*(required)[go, cpp, csharp, java, kotlin, objc, php, python, pyi, ruby, dart, node] |
| -lang | Choose language to generate \*[required](go, cpp, csharp, java, kotlin, objc, php, python, pyi, ruby, dart, node) |

### TODO

Expand Down

0 comments on commit f6442b7

Please sign in to comment.