From a88f835031c1bf6d3018325452e6634671f3df05 Mon Sep 17 00:00:00 2001 From: suzaku Date: Thu, 16 Sep 2021 13:46:28 +0800 Subject: [PATCH] Set up goreleaser --- .github/workflows/build.yml | 24 +++++++++++++++++++++++- .goreleaser.yml | 31 +++++++++++++++++++++++++++++++ 2 files changed, 54 insertions(+), 1 deletion(-) create mode 100644 .goreleaser.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6d87dcb..678c3aa 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -25,4 +25,26 @@ jobs: with: fetch-depth: 0 - uses: actions/setup-go@v2 - - run: go test ./... \ No newline at end of file + with: + go-version: 1.17 + - run: go test ./... + goreleaser: + needs: [ golangci, test ] + if: success() && startsWith(github.ref, 'refs/tags/') + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + fetch-depth: 0 + - name: Set up Go + uses: actions/setup-go@v2 + with: + go-version: 1.17 + - name: Run GoReleaser + uses: goreleaser/goreleaser-action@v2 + with: + version: latest + args: release --rm-dist + env: + GITHUB_TOKEN: ${{ secrets.GH_PAT }} \ No newline at end of file diff --git a/.goreleaser.yml b/.goreleaser.yml new file mode 100644 index 0000000..c32cd1c --- /dev/null +++ b/.goreleaser.yml @@ -0,0 +1,31 @@ +builds: + - env: + - CGO_ENABLED=0 + goos: + - linux + - darwin + goarch: + - 386 + - amd64 + - arm + - arm64 + mod_timestamp: '{{ .CommitTimestamp }}' +archives: + - name_template: '{{ .ProjectName }}_{{ .Os }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}' + replacements: + darwin: Mac + linux: Linux + 386: i386 + amd64: x86_64 + +brews: + - tap: + owner: suzaku + name: homebrew + folder: Formula + homepage: https://github.com/suzaku/rose + description: A command line tool that allows you to treat files as sets of rows and perform set operations on them. + test: | + system "#{bin}/rose -v" + install: |- + bin.install "rose"