From 0ef1c4b9debadc968329bfbc05e3ad701a8813b0 Mon Sep 17 00:00:00 2001 From: Suzuki Shunsuke Date: Mon, 25 Oct 2021 06:47:03 +0900 Subject: [PATCH] chore: publish a homebrew-tap recipe https://goreleaser.com/customization/homebrew/ --- .github/workflows/test.yaml | 9 +++++++++ .goreleaser.yml | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 31ad7ac60..a87c52c32 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -22,6 +22,14 @@ jobs: - run: go test -v ./... -race -covermode=atomic + - name: Generate token + id: generate_token + if: startsWith(github.ref, 'refs/tags/') + uses: tibdex/github-app-token@v1 + with: + app_id: ${{ secrets.APP_ID }} + private_key: ${{ secrets.APP_PRIVATE_KEY }} + - name: remove changes # Sometimes it is failed to release by goreleaser due to changes of go.sum run: git checkout -- . @@ -37,3 +45,4 @@ jobs: args: release --rm-dist env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + HOMEBREW_TAP_GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }} diff --git a/.goreleaser.yml b/.goreleaser.yml index 8f06668c9..19f90bc64 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -16,3 +16,37 @@ builds: - arm64 release: prerelease: true +brews: +- + # NOTE: make sure the url_template, the token and given repo (github or gitlab) owner and name are from the + # same kind. We will probably unify this in the next major version like it is done with scoop. + + # GitHub/GitLab repository to push the formula to + tap: + owner: suzuki-shunsuke + name: homebrew-aqua + token: "{{ .Env.HOMEBREW_TAP_GITHUB_TOKEN }}" + # The project name and current git tag are used in the format string. + commit_msg_template: "Brew formula update for {{ .ProjectName }} version {{ .Tag }}" + # Your app's homepage. + # Default is empty. + homepage: https://github.com/suzuki-shunsuke/aqua + + # Template of your app's description. + # Default is empty. + description: | + Declarative CLI Version manager. Support Lazy Install and Sharable configuration mechanism named Registry. Switch versions seamlessly + license: MIT + + # Setting this will prevent goreleaser to actually try to commit the updated + # formula - instead, the formula file will be stored on the dist folder only, + # leaving the responsibility of publishing it to the user. + # If set to auto, the release will not be uploaded to the homebrew tap + # in case there is an indicator for prerelease in the tag e.g. v1.0.0-rc1 + # Default is false. + skip_upload: auto + + # So you can `brew test` your formula. + # Default is empty. + test: | + system "#{bin}/aqua --version"