From 2e9b3cc481a95f8fcac44d89c57097e1efd17e79 Mon Sep 17 00:00:00 2001 From: Benjamin Kane Date: Thu, 25 Nov 2021 00:35:02 -0800 Subject: [PATCH] update github workflow --- .github/workflows/gorelease.yml | 7 +++++-- README.md | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+), 2 deletions(-) diff --git a/.github/workflows/gorelease.yml b/.github/workflows/gorelease.yml index bb2b4bd..cd664f9 100644 --- a/.github/workflows/gorelease.yml +++ b/.github/workflows/gorelease.yml @@ -4,6 +4,10 @@ on: push: tags: - 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10 + +permissions: + contents: write + jobs: goreleaser: runs-on: ubuntu-latest @@ -16,7 +20,7 @@ jobs: - name: Set up Go 1.x uses: actions/setup-go@v2 with: - go-version: ^1.16 + go-version: 1.17 - name: Run GoReleaser uses: goreleaser/goreleaser-action@v2 @@ -26,4 +30,3 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} KEY_GITHUB_GORELEASER_TO_HOMEBREW_TAP: ${{ secrets.KEY_GITHUB_GORELEASER_TO_HOMEBREW_TAP }} - diff --git a/README.md b/README.md index 25526c1..ebf2270 100644 --- a/README.md +++ b/README.md @@ -7,3 +7,36 @@ Basically a replacement to GNU Stow for my use cases: - add --script filename.sh flag that prints out an equivalent bash script to a file - reconsider relative symlinks to be more stow compatible? Maybe with --type relative|absolute flag? - README! + +# goreleaser notes + +## locally + +Need to release with an unpushed new tag each time. Otherwise you get an error like: + +``` + ⨯ release failed after 1.62s error=scm releases: failed to publish artifacts: failed to upload checksums.txt after 1 tries: POST https://uploads.github.com/repos/bbkane/fling/releases/54053584/assets?name=checksums.txt: 422 Validation Failed [{Resource:ReleaseAsset Field:name Code:already_exists Message:}] +``` +Need to export GITHUB_TOKEN and KEY_GITHUB_GORELEASER_TO_HOMEBREW_TAP (see KeePassXC) + +``` +$ goreleaser release --rm-dist +``` + +Now that a local release is working, I'll try the CI/CD to avoid the following error? + +``` + ⨯ release failed after 31.30s error=homebrew tap formula: failed to publish artifacts: PUT https://api.github.com/repos/bbkane/homebrew-tap/contents/Formula/fling.rb: 404 Not Found [] +``` + +Still got it. I updated the repo secret to be obviously wrong. Let's see if the error message changes. + +``` + ⨯ release failed after 15.99s error=homebrew tap formula: failed to publish artifacts: GET https://api.github.com/repos/bbkane/homebrew-tap/contents/Formula/fling.rb: 401 Bad credentials [] +``` + +So that wasn't it... + +Looking at the previous release, when I GET that file I don't get a 404 lile goreleaser says it does - https://api.github.com/repos/bbkane/homebrew-tap/contents/Formula/fling.rb + +https://goreleaser.com/ci/actions/ - adding permissions to the job