Skip to content

Commit 9bac7b1

Browse files
ci: update release workflow and goreleaser configuration
Refactor the GitHub Actions release workflow to improve tag handling and environment variable usage. Update GoReleaser configuration to use the new `brews` field instead of the deprecated `homebrew_casks` and integrate the `TAP_GITHUB_TOKEN` for automated tap updates.
1 parent 113ac03 commit 9bac7b1

2 files changed

Lines changed: 20 additions & 15 deletions

File tree

.github/workflows/release.yml

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ permissions:
1212
jobs:
1313
goreleaser:
1414
runs-on: ubuntu-latest
15+
1516
steps:
1617
- name: Checkout
1718
uses: actions/checkout@v4
@@ -21,38 +22,39 @@ jobs:
2122
- name: Set up Go
2223
uses: actions/setup-go@v5
2324
with:
24-
go-version-file: 'go.mod' # ← reads from go.mod, no manual updates needed
25+
go-version-file: 'go.mod'
2526

2627
- name: Read version
27-
id: get_version
2828
run: echo "VERSION=$(cat VERSION.txt)" >> $GITHUB_ENV
2929

3030
- name: Create tag
3131
run: |
3232
git config user.name "github-actions[bot]"
3333
git config user.email "github-actions[bot]@users.noreply.github.com"
34-
if git rev-parse "${{ env.VERSION }}" >/dev/null 2>&1; then
35-
TAGGED_COMMIT=$(git rev-list -n 1 "${{ env.VERSION }}")
34+
35+
if git rev-parse "${VERSION}" >/dev/null 2>&1; then
36+
TAGGED_COMMIT=$(git rev-list -n 1 "${VERSION}")
3637
CURRENT_COMMIT=$(git rev-parse HEAD)
38+
3739
if [ "$TAGGED_COMMIT" != "$CURRENT_COMMIT" ]; then
3840
echo "Tag exists but points to wrong commit. Force-updating..."
39-
git tag -f ${{ env.VERSION }}
40-
git push origin ${{ env.VERSION }} --force
41+
git tag -f "${VERSION}"
42+
git push origin "${VERSION}" --force
4143
else
42-
echo "Tag ${{ env.VERSION }} already points to HEAD, skipping."
44+
echo "Tag already correct. Skipping."
4345
fi
4446
else
45-
git tag ${{ env.VERSION }}
46-
git push origin ${{ env.VERSION }}
47+
git tag "${VERSION}"
48+
git push origin "${VERSION}"
4749
fi
4850
4951
- name: Run GoReleaser
50-
uses: goreleaser/goreleaser-action@v7 # ← was v6
52+
uses: goreleaser/goreleaser-action@v7
5153
with:
5254
distribution: goreleaser
5355
version: latest
5456
args: release --clean
5557
env:
56-
# A Personal Access Token (PAT) is required to push to the external tap repo
57-
GITHUB_TOKEN: ${{ secrets.TAP_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
58+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
59+
TAP_GITHUB_TOKEN: ${{ secrets.TAP_GITHUB_TOKEN }}
5860

.goreleaser.yaml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,15 +69,18 @@ changelog:
6969
- '^README'
7070
- '^Merge'
7171
- '^Brew'
72-
72+
7373
release:
7474
draft: false
7575
prerelease: auto
7676

77-
homebrew_casks:
78-
- repository:
77+
brews:
78+
- name: kairo
79+
80+
repository:
7981
owner: programmersd21
8082
name: kairo_tap
83+
token: "{{ .Env.TAP_GITHUB_TOKEN }}"
8184

8285
directory: Casks
8386

0 commit comments

Comments
 (0)