Skip to content

Commit 0557ea0

Browse files
feat: add GitHub Actions workflow to automate releases using GoReleaser
1 parent a8a94ad commit 0557ea0

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

.github/workflows/release.yml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,16 @@ jobs:
3131
run: |
3232
git config user.name "github-actions[bot]"
3333
git config user.email "github-actions[bot]@users.noreply.github.com"
34-
# Skip if tag already exists (safe for re-runs and workflow_dispatch)
3534
if git rev-parse "${{ env.VERSION }}" >/dev/null 2>&1; then
36-
echo "Tag ${{ env.VERSION }} already exists, skipping."
35+
TAGGED_COMMIT=$(git rev-list -n 1 "${{ env.VERSION }}")
36+
CURRENT_COMMIT=$(git rev-parse HEAD)
37+
if [ "$TAGGED_COMMIT" != "$CURRENT_COMMIT" ]; then
38+
echo "Tag exists but points to wrong commit. Force-updating..."
39+
git tag -f ${{ env.VERSION }}
40+
git push origin ${{ env.VERSION }} --force
41+
else
42+
echo "Tag ${{ env.VERSION }} already points to HEAD, skipping."
43+
fi
3744
else
3845
git tag ${{ env.VERSION }}
3946
git push origin ${{ env.VERSION }}

0 commit comments

Comments
 (0)