@@ -41,16 +41,16 @@ jobs:
4141 echo "Package version: $PACKAGE_VERSION"
4242
4343 - name : Create tag for manual trigger
44- if : github.event_name == 'workflow_dispatch' && inputs.create_tag == ' true'
44+ if : github.event_name == 'workflow_dispatch' && inputs.create_tag == true
4545 env :
4646 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
4747 run : |
4848 VERSION="v${{ steps.package_version.outputs.package_version }}"
4949 echo "Creating tag: $VERSION"
5050
51- # Check if tag already exists
52- if git rev-parse " $VERSION" >/dev/null 2>&1 ; then
53- echo "❌ Tag $VERSION already exists!"
51+ # Check if tag already exists on remote
52+ if git ls-remote --tags origin | grep -q "refs/tags/ $VERSION$" ; then
53+ echo "❌ Tag $VERSION already exists on remote !"
5454 echo "Please update the version in package.json or delete the existing tag."
5555 exit 1
5656 fi
8686 fi
8787 echo "✅ Version check passed: ${{ steps.extract_version.outputs.tag_version }}"
8888
89+ - name : Determine tag name
90+ id : tag_name
91+ run : |
92+ if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
93+ TAG_NAME="v${{ steps.extract_version.outputs.tag_version }}"
94+ else
95+ TAG_NAME="${{ github.ref_name }}"
96+ fi
97+ echo "tag_name=$TAG_NAME" >> $GITHUB_OUTPUT
98+ echo "Tag name: $TAG_NAME"
99+
89100 - name : Install dependencies
90101 run : npm ci
91102
@@ -144,29 +155,16 @@ jobs:
144155 env :
145156 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
146157 run : |
147- # Determine the tag name based on trigger type
148- if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
149- TAG_NAME="v${{ steps.extract_version.outputs.tag_version }}"
150- else
151- TAG_NAME="${{ github.ref_name }}"
152- fi
153-
154- echo "Creating release for tag: $TAG_NAME"
158+ echo "Creating release for tag: ${{ steps.tag_name.outputs.tag_name }}"
155159
156160 # Create release with notes and upload VSIX file
157- gh release create "$TAG_NAME " \
161+ gh release create "${{ steps.tag_name.outputs.tag_name }} " \
158162 --title "Release ${{ steps.extract_version.outputs.tag_version }}" \
159163 --notes "${{ steps.release_notes.outputs.notes }}" \
160164 ./${{ steps.vsix_filename.outputs.vsix_file }}
161165
162166 - name : Release Summary
163167 run : |
164- if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
165- TAG_NAME="v${{ steps.extract_version.outputs.tag_version }}"
166- else
167- TAG_NAME="${{ github.ref_name }}"
168- fi
169-
170168 echo "🎉 Release ${{ steps.extract_version.outputs.tag_version }} created successfully!"
171169 echo "📦 VSIX package: ${{ steps.vsix_filename.outputs.vsix_file }}"
172- echo "🔗 Release URL: https://github.com/${{ github.repository }}/releases/tag/$TAG_NAME "
170+ echo "🔗 Release URL: https://github.com/${{ github.repository }}/releases/tag/${{ steps.tag_name.outputs.tag_name }} "
0 commit comments