File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -121,6 +121,28 @@ jobs:
121121 fetch-depth : 0
122122 persist-credentials : true
123123
124+ - name : Verify tag does not already exist
125+ run : |
126+ TAG_NAME="${{ steps.release.outputs.tag_name }}"
127+
128+ echo "Checking if tag $TAG_NAME already exists..."
129+
130+ # Check if tag exists locally
131+ if git rev-parse "$TAG_NAME" >/dev/null 2>&1; then
132+ echo "::error::Tag $TAG_NAME already exists in the repository."
133+ echo "Please use a different version number or delete the existing tag first."
134+ exit 1
135+ fi
136+
137+ # Check if tag exists on remote
138+ if git ls-remote --tags origin "$TAG_NAME" | grep -q "$TAG_NAME"; then
139+ echo "::error::Tag $TAG_NAME already exists on remote."
140+ echo "Please use a different version number or delete the existing tag first."
141+ exit 1
142+ fi
143+
144+ echo "Tag $TAG_NAME does not exist. Proceeding with release."
145+
124146 - name : Set up JDK 25
125147 uses : actions/setup-java@v5
126148 with :
You can’t perform that action at this time.
0 commit comments