File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 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 }}
You can’t perform that action at this time.
0 commit comments