Skip to content

Commit 8197ebb

Browse files
committed
fix: resolve GitHub Actions release permissions and workflow issues
- Add proper permissions (contents: write) to allow release creation - Remove conflicting auto-update-version job that was causing race conditions - Update to softprops/action-gh-release@v2 for better reliability - Simplify workflow since release.sh already handles version updates - Use explicit token parameter instead of env variable
1 parent 46db514 commit 8197ebb

File tree

1 file changed

+8
-48
lines changed

1 file changed

+8
-48
lines changed

.github/workflows/release.yml

Lines changed: 8 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ on:
77
pull_request:
88
branches: [ main, master ]
99

10+
permissions:
11+
contents: write
12+
actions: read
13+
security-events: write
14+
1015
jobs:
1116
test:
1217
runs-on: ubuntu-latest
@@ -36,57 +41,13 @@ jobs:
3641
- name: Run staticcheck
3742
run: staticcheck ./...
3843

39-
auto-update-version:
40-
needs: test
41-
runs-on: ubuntu-latest
42-
if: startsWith(github.ref, 'refs/tags/')
43-
44-
steps:
45-
- uses: actions/checkout@v4
46-
with:
47-
token: ${{ secrets.GITHUB_TOKEN }}
48-
fetch-depth: 0
49-
50-
- name: Get version
51-
id: version
52-
run: |
53-
VERSION=${GITHUB_REF#refs/tags/v}
54-
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
55-
echo "TAG=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
56-
57-
- name: Update version in files
58-
run: |
59-
VERSION="${{ steps.version.outputs.VERSION }}"
60-
61-
# Update main.go
62-
sed -i "s/Version = \".*\"/Version = \"$VERSION\"/" main.go
63-
64-
# Update build-release.sh
65-
sed -i "s/VERSION=\".*\"/VERSION=\"$VERSION\"/" build-release.sh
66-
67-
# Update install.sh
68-
sed -i "s/VERSION=\".*\"/VERSION=\"$VERSION\"/" install.sh
69-
70-
echo "Updated version to $VERSION in all files"
71-
72-
- name: Commit version updates
73-
run: |
74-
git config --local user.email "[email protected]"
75-
git config --local user.name "GitHub Action"
76-
git add main.go build-release.sh install.sh
77-
git diff --staged --quiet || git commit -m "chore: auto-update version to ${{ steps.version.outputs.VERSION }}"
78-
git push origin HEAD:main
79-
continue-on-error: true
80-
8144
build:
82-
needs: [test, auto-update-version]
45+
needs: test
8346
runs-on: ubuntu-latest
8447
if: startsWith(github.ref, 'refs/tags/')
8548

8649
steps:
8750
- uses: actions/checkout@v4
88-
with:
89-
ref: main # Get the updated files from auto-update-version job
9051

9152
- name: Set up Go
9253
uses: actions/setup-go@v4
@@ -106,7 +67,7 @@ jobs:
10667
./build-release.sh
10768
10869
- name: Create Release
109-
uses: softprops/action-gh-release@v1
70+
uses: softprops/action-gh-release@v2
11071
with:
11172
files: |
11273
dist/*.tar.gz
@@ -164,5 +125,4 @@ jobs:
164125
sha256sum -c checksums.txt
165126
```
166127
generate_release_notes: true
167-
env:
168-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
128+
token: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)