From 0e169a9c00a982982a02a68f226e12f571e7bc6a Mon Sep 17 00:00:00 2001 From: PoAn Yang Date: Wed, 18 Sep 2024 14:23:04 +0800 Subject: [PATCH] fix: release pipeline (#104) * change actions/checkout to v4 * change actions/setup-go to v5 * change go-version to v1.22 * change goreleaser/goreleaser-action to v6 * add "version: 2" to .goreleaser.yml * remove darwin from .goreleaser.yml, because we import longhorn/go-common-libs which uses unix.CLONE_NEWNET Signed-off-by: PoAn Yang --- .github/workflows/release.yml | 34 +++++++++++++++------------------- .goreleaser.yml | 9 ++------- 2 files changed, 17 insertions(+), 26 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 64043c40..9081755d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,12 +1,12 @@ # This GitHub action can publish assets for release when a tag is created. # Currently its setup to run on any tag that matches the pattern "v*" (ie. v0.1.0). # -# This uses an action (hashicorp/ghaction-import-gpg) that assumes you set your +# This uses an action (hashicorp/ghaction-import-gpg) that assumes you set your # private key in the `GPG_PRIVATE_KEY` secret and passphrase in the `PASSPHRASE` # secret. If you would rather own your own GPG handling, please fork this action # or use an alternative one for key handling. # -# You will need to pass the `--batch` flag to `gpg` in your signing step +# You will need to pass the `--batch` flag to `gpg` in your signing step # in `goreleaser` to indicate this is being used in a non-interactive mode. # name: release @@ -18,31 +18,27 @@ jobs: goreleaser: runs-on: ubuntu-latest steps: - - - name: Checkout - uses: actions/checkout@v3 - - - name: Unshallow - run: git fetch --prune --unshallow - - - name: Set up Go - uses: actions/setup-go@v3 + - name: Checkout + uses: actions/checkout@v4 with: - go-version: '1.20' - - - name: Import GPG key + fetch-depth: 0 + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version: '1.22' + - name: Import GPG key id: import_gpg uses: crazy-max/ghaction-import-gpg@v5 with: # These secrets will need to be configured for the repository: gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }} passphrase: ${{ secrets.PASSPHRASE }} - - - name: Run GoReleaser - uses: goreleaser/goreleaser-action@v3 + - name: Run GoReleaser + uses: goreleaser/goreleaser-action@v6 with: - version: latest - args: release --rm-dist + distribution: goreleaser + version: '~> v2' + args: release --clean env: GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }} # GitHub sets this automatically diff --git a/.goreleaser.yml b/.goreleaser.yml index be63fbe0..1bfd0e58 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -1,5 +1,6 @@ # Visit https://goreleaser.com for documentation on how to customize this # behavior. +version: 2 before: hooks: # this is just an example and not a requirement for provider building/publishing @@ -17,7 +18,6 @@ builds: - '-s -w -X main.version={{.Version}} -X main.commit={{.Commit}}' goos: - linux - - darwin goarch: - amd64 - arm64 @@ -31,7 +31,7 @@ checksum: signs: - artifacts: checksum args: - # if you are using this in a GitHub action or some other automated pipeline, you + # if you are using this in a GitHub action or some other automated pipeline, you # need to pass the batch flag to indicate its not interactive. - "--batch" - "--local-user" @@ -40,8 +40,3 @@ signs: - "${signature}" - "--detach-sign" - "${artifact}" -release: - # If you want to manually examine the release before its live, uncomment this line: - # draft: true -changelog: - skip: true