Skip to content

Commit 5422ce4

Browse files
committed
fix token on release
1 parent f82dcb9 commit 5422ce4

File tree

1 file changed

+7
-16
lines changed

1 file changed

+7
-16
lines changed

.github/workflows/release.yml

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,23 @@
1-
# .github/workflows/release.yml
21
name: Release
32

43
on:
54
push:
6-
# This workflow will run only when you push a tag that starts with 'v'
7-
# For example: v1.2.1, v1.3.0, etc.
85
tags:
96
- 'v*.*.*'
107

8+
permissions:
9+
contents: write
10+
packages: write
11+
issues: write
12+
1113
jobs:
1214
goreleaser:
1315
runs-on: ubuntu-latest
1416
steps:
1517
- name: Checkout
1618
uses: actions/checkout@v4
1719
with:
18-
fetch-depth: 0 # Fetch all history so GoReleaser can generate a changelog if needed
20+
fetch-depth: 0
1921

2022
- name: Set up Go
2123
uses: actions/setup-go@v5
@@ -24,25 +26,14 @@ jobs:
2426
id: extract_notes
2527
run: |
2628
NOTES_FILE=$(mktemp)
27-
# The tag is in the format vX.Y.Z. We need to extract X.Y.Z.
2829
VERSION=$(echo "${{ github.ref_name }}" | sed 's/^v//')
29-
# Use awk to find the section for the current version and print its content
30-
# until we hit the separator for the next version ('---').
31-
# This extracts the body of the latest changelog entry for the release notes.
3230
awk -v ver="## [$VERSION]" '$0 ~ ver {p=1; next} p && /^---/ {exit} p' CHANGELOG.md > "$NOTES_FILE"
3331
echo "notes_path=$NOTES_FILE" >> $GITHUB_OUTPUT
3432
3533
- name: Run GoReleaser
3634
uses: goreleaser/goreleaser-action@v5
3735
with:
38-
# Use the latest v2 GoReleaser version. The 'notes_file' option
39-
# in .goreleaser.yml requires GoReleaser v2.0.0 or newer.
4036
version: '~> v2'
41-
# The '--clean' flag removes the 'dist' directory before building.
4237
args: release --clean
43-
# Pass the release notes file directly to the action.
4438
release_notes: ${{ steps.extract_notes.outputs.notes_path }}
45-
env:
46-
# This token is provided by GitHub automatically and is required
47-
# to create a release and upload assets.
48-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
39+
token: ${{ secrets.GITHUB_TOKEN }} # <-- Explicitly pass token

0 commit comments

Comments
 (0)