|
11 | 11 | options: |
12 | 12 | - pre-release |
13 | 13 | - release |
| 14 | + tag: |
| 15 | + description: "Enter existing tag to publish (e.g., v3.1.2)" |
| 16 | + required: true |
| 17 | + type: string |
14 | 18 |
|
15 | 19 | permissions: |
16 | 20 | contents: write |
|
30 | 34 |
|
31 | 35 | steps: |
32 | 36 | - uses: actions/checkout@v4 |
| 37 | + with: |
| 38 | + ref: ${{ github.event.inputs.tag }} |
33 | 39 |
|
34 | 40 | - name: Setup Node.js |
35 | 41 | uses: actions/setup-node@v4 |
@@ -69,14 +75,20 @@ jobs: |
69 | 75 | VERSION=$(node -p "require('./package.json').version") |
70 | 76 | echo "version=$VERSION" >> $GITHUB_OUTPUT |
71 | 77 |
|
72 | | - - name: Create Git Tag |
73 | | - id: create_tag |
| 78 | + - name: Validate Tag |
| 79 | + id: validate_tag |
74 | 80 | run: | |
75 | | - VERSION=v${{ steps.get_version.outputs.version }} |
76 | | - echo "tag=$VERSION" >> $GITHUB_OUTPUT |
77 | | - echo "Tagging with $VERSION" |
78 | | - git tag "$VERSION" |
79 | | - git push origin "$VERSION" |
| 81 | + TAG="${{ github.event.inputs.tag }}" |
| 82 | + echo "tag=$TAG" >> $GITHUB_OUTPUT |
| 83 | + echo "Using existing tag: $TAG" |
| 84 | +
|
| 85 | + # Verify the tag exists |
| 86 | + if ! git rev-parse "$TAG" >/dev/null 2>&1; then |
| 87 | + echo "Error: Tag '$TAG' does not exist in the repository" |
| 88 | + exit 1 |
| 89 | + fi |
| 90 | +
|
| 91 | + echo "Tag '$TAG' validated successfully" |
80 | 92 |
|
81 | 93 | - name: Package and Publish Extension |
82 | 94 | env: |
@@ -106,7 +118,7 @@ jobs: |
106 | 118 | - name: Create GitHub Release |
107 | 119 | uses: softprops/action-gh-release@v1 |
108 | 120 | with: |
109 | | - tag_name: ${{ steps.create_tag.outputs.tag }} |
| 121 | + tag_name: ${{ steps.validate_tag.outputs.tag }} |
110 | 122 | files: "*.vsix" |
111 | 123 | # body: ${{ steps.changelog.outputs.content }} |
112 | 124 | generate_release_notes: true |
|
0 commit comments