Skip to content

Commit 7c1e46b

Browse files
nficanoclaude
andcommitted
Fix release workflow: trigger on push to main with auto-versioning
- Change trigger from tag push to main branch push - Auto-increment patch version from latest tag - Extract debaser to temp dir to avoid dirtying git state - Create and push tag automatically in the workflow Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 07bb119 commit 7c1e46b

1 file changed

Lines changed: 29 additions & 3 deletions

File tree

.github/workflows/release.yml

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: Release
22

33
on:
44
push:
5-
tags: ["v*"]
5+
branches: [main]
66

77
permissions:
88
contents: write
@@ -17,14 +17,40 @@ jobs:
1717
with:
1818
fetch-depth: 0
1919

20+
- name: Determine next version
21+
id: version
22+
run: |
23+
latest=$(git tag -l 'v*' --sort=-v:refname | head -n1)
24+
if [ -z "$latest" ]; then
25+
next="v0.1.0"
26+
else
27+
# Strip leading 'v', increment patch
28+
base="${latest#v}"
29+
major=$(echo "$base" | cut -d. -f1)
30+
minor=$(echo "$base" | cut -d. -f2)
31+
patch=$(echo "$base" | cut -d. -f3)
32+
next="v${major}.${minor}.$((patch + 1))"
33+
fi
34+
echo "tag=$next" >> "$GITHUB_OUTPUT"
35+
echo "Next version: $next"
36+
37+
- name: Create release tag
38+
run: |
39+
git config user.name "github-actions[bot]"
40+
git config user.email "github-actions[bot]@users.noreply.github.com"
41+
git tag -a "${{ steps.version.outputs.tag }}" -m "Release ${{ steps.version.outputs.tag }}"
42+
git push origin "${{ steps.version.outputs.tag }}"
43+
2044
- uses: actions/setup-go@v5
2145
with:
2246
go-version: "1.24"
2347

2448
- name: Install debaser
2549
run: |
26-
curl -sL "https://github.com/nficano/debaser/releases/latest/download/debaser-v0.1.11-x86_64-unknown-linux-gnu.tar.gz" | tar xz
27-
sudo mv debaser-v0.1.11-x86_64-unknown-linux-gnu/debaser /usr/local/bin/
50+
tmp=$(mktemp -d)
51+
curl -sL "https://github.com/nficano/debaser/releases/latest/download/debaser-v0.1.11-x86_64-unknown-linux-gnu.tar.gz" | tar xz -C "$tmp"
52+
sudo mv "$tmp"/debaser-*/debaser /usr/local/bin/
53+
rm -rf "$tmp"
2854
2955
- name: Generate release name
3056
id: release-name

0 commit comments

Comments
 (0)