Skip to content

Commit dc177d6

Browse files
committed
ci: auto-bump version.go after release
1 parent 5c5c350 commit dc177d6

1 file changed

Lines changed: 34 additions & 0 deletions

File tree

.github/workflows/release.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,40 @@ jobs:
4545
env:
4646
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4747

48+
update-version:
49+
needs: goreleaser
50+
runs-on: ubuntu-latest
51+
steps:
52+
- name: Get tag
53+
id: tag
54+
run: |
55+
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
56+
echo "tag=${{ inputs.tag }}" >> "$GITHUB_OUTPUT"
57+
else
58+
echo "tag=${GITHUB_REF#refs/tags/}" >> "$GITHUB_OUTPUT"
59+
fi
60+
61+
- name: Checkout main
62+
uses: actions/checkout@v6
63+
with:
64+
ref: main
65+
66+
- name: Update version.go
67+
run: |
68+
TAG="${{ steps.tag.outputs.tag }}"
69+
VERSION="${TAG#v}"
70+
sed -i "s/version = \".*\"/version = \"${VERSION}-dev\"/" internal/cmd/version.go
71+
cat internal/cmd/version.go
72+
73+
- name: Commit and push
74+
run: |
75+
git config user.name "github-actions[bot]"
76+
git config user.email "github-actions[bot]@users.noreply.github.com"
77+
git add internal/cmd/version.go
78+
git diff --cached --quiet && exit 0
79+
git commit -m "chore: bump version to ${{ steps.tag.outputs.tag }}-dev"
80+
git push origin main
81+
4882
update-homebrew:
4983
needs: goreleaser
5084
runs-on: ubuntu-latest

0 commit comments

Comments
 (0)