|
9 | 9 | create_tag: |
10 | 10 | description: 'Create tag from package.json version' |
11 | 11 | required: false |
12 | | - default: 'true' |
| 12 | + default: true |
13 | 13 | type: boolean |
14 | 14 | publish_marketplace: |
15 | 15 | description: 'Publish to VS Code Marketplace after creating the release' |
16 | 16 | required: false |
17 | | - default: 'true' |
| 17 | + default: true |
18 | 18 | type: boolean |
19 | 19 |
|
20 | 20 | permissions: |
|
63 | 63 | echo "package_version=$PACKAGE_VERSION" >> $GITHUB_OUTPUT |
64 | 64 | echo "Package version: $PACKAGE_VERSION" |
65 | 65 | |
66 | | - - name: Create tag for manual trigger |
67 | | - if: steps.trigger_type.outputs.is_manual == 'true' && inputs.create_tag |
68 | | - env: |
69 | | - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
70 | | - run: | |
71 | | - VERSION="v${{ steps.package_version.outputs.package_version }}" |
72 | | - echo "Creating tag: $VERSION" |
73 | | - |
74 | | - # Check if tag already exists on remote using exit code |
75 | | - if git ls-remote --exit-code --tags origin "refs/tags/$VERSION" >/dev/null 2>&1; then |
76 | | - echo "❌ Tag $VERSION already exists on remote!" |
77 | | - echo "Please update the version in package.json or delete the existing tag." |
78 | | - exit 1 |
79 | | - fi |
80 | | - |
81 | | - # Create and push the tag |
82 | | - git config --local user.name "github-actions[bot]" |
83 | | - git config --local user.email "github-actions[bot]@users.noreply.github.com" |
84 | | - git tag -a "$VERSION" -m "Release $VERSION" |
85 | | - git push origin "$VERSION" |
86 | | - |
87 | | - # Verify tag was created successfully on remote |
88 | | - echo "Verifying tag was created on remote..." |
89 | | - for i in {1..5}; do |
90 | | - if git ls-remote --exit-code --tags origin "refs/tags/$VERSION" >/dev/null 2>&1; then |
91 | | - echo "✅ Tag $VERSION created and verified on remote" |
92 | | - exit 0 |
93 | | - fi |
94 | | - echo "Waiting for tag to propagate (attempt $i/5)..." |
95 | | - sleep 2 |
96 | | - done |
97 | | - |
98 | | - echo "❌ Failed to verify tag creation on remote" |
99 | | - exit 1 |
100 | | - |
101 | 66 | - name: Extract version from tag |
102 | 67 | id: extract_version |
103 | 68 | run: | |
@@ -176,6 +141,72 @@ jobs: |
176 | 141 | fs.writeFileSync('CHANGELOG.md', changelog); |
177 | 142 | console.log('✅ Updated CHANGELOG.md with v' + version + ' notes for VSIX packaging'); |
178 | 143 | " "$VERSION" |
| 144 | +
|
| 145 | + - name: Create changelog branch and commit |
| 146 | + if: steps.trigger_type.outputs.is_manual == 'true' |
| 147 | + id: changelog_branch |
| 148 | + env: |
| 149 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 150 | + run: | |
| 151 | + VERSION="${{ steps.extract_version.outputs.tag_version }}" |
| 152 | + BRANCH="changelog/v${VERSION}" |
| 153 | + echo "branch=$BRANCH" >> $GITHUB_OUTPUT |
| 154 | +
|
| 155 | + git config --local user.name "github-actions[bot]" |
| 156 | + git config --local user.email "github-actions[bot]@users.noreply.github.com" |
| 157 | +
|
| 158 | + # Check if branch already exists on remote |
| 159 | + if git ls-remote --exit-code --heads origin "refs/heads/$BRANCH" >/dev/null 2>&1; then |
| 160 | + echo "❌ Branch $BRANCH already exists on remote!" |
| 161 | + echo "Delete it or bump the version before re-running." |
| 162 | + exit 1 |
| 163 | + fi |
| 164 | +
|
| 165 | + if git diff --quiet CHANGELOG.md; then |
| 166 | + echo "ℹ️ No changes to CHANGELOG.md, skipping branch + commit" |
| 167 | + exit 0 |
| 168 | + fi |
| 169 | +
|
| 170 | + git checkout -b "$BRANCH" |
| 171 | + git add CHANGELOG.md |
| 172 | + git commit -m "docs: update CHANGELOG.md for v${VERSION}" |
| 173 | + git push origin "$BRANCH" |
| 174 | + echo "✅ Pushed CHANGELOG.md update to $BRANCH" |
| 175 | +
|
| 176 | + - name: Create tag for manual trigger |
| 177 | + if: steps.trigger_type.outputs.is_manual == 'true' && inputs.create_tag == true |
| 178 | + env: |
| 179 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 180 | + run: | |
| 181 | + VERSION="v${{ steps.package_version.outputs.package_version }}" |
| 182 | + echo "Creating tag: $VERSION" |
| 183 | + |
| 184 | + # Check if tag already exists on remote using exit code |
| 185 | + if git ls-remote --exit-code --tags origin "refs/tags/$VERSION" >/dev/null 2>&1; then |
| 186 | + echo "❌ Tag $VERSION already exists on remote!" |
| 187 | + echo "Please update the version in package.json or delete the existing tag." |
| 188 | + exit 1 |
| 189 | + fi |
| 190 | + |
| 191 | + # Create and push the tag |
| 192 | + git config --local user.name "github-actions[bot]" |
| 193 | + git config --local user.email "github-actions[bot]@users.noreply.github.com" |
| 194 | + git tag -a "$VERSION" -m "Release $VERSION" |
| 195 | + git push origin "$VERSION" |
| 196 | + |
| 197 | + # Verify tag was created successfully on remote |
| 198 | + echo "Verifying tag was created on remote..." |
| 199 | + for i in {1..5}; do |
| 200 | + if git ls-remote --exit-code --tags origin "refs/tags/$VERSION" >/dev/null 2>&1; then |
| 201 | + echo "✅ Tag $VERSION created and verified on remote" |
| 202 | + exit 0 |
| 203 | + fi |
| 204 | + echo "Waiting for tag to propagate (attempt $i/5)..." |
| 205 | + sleep 2 |
| 206 | + done |
| 207 | + |
| 208 | + echo "❌ Failed to verify tag creation on remote" |
| 209 | + exit 1 |
179 | 210 | |
180 | 211 | - name: Install dependencies |
181 | 212 | run: npm ci |
@@ -333,65 +364,4 @@ jobs: |
333 | 364 | echo "with the \`Marketplace (Publish)\` scope for all accessible organizations." >> $GITHUB_STEP_SUMMARY |
334 | 365 | fi |
335 | 366 |
|
336 | | - update-changelog: |
337 | | - needs: release |
338 | | - if: always() && needs.release.result == 'success' |
339 | | - runs-on: ubuntu-latest |
340 | | - permissions: |
341 | | - contents: write |
342 | | - pull-requests: write |
343 | | - |
344 | | - steps: |
345 | | - - name: Harden the runner (Audit all outbound calls) |
346 | | - uses: step-security/harden-runner@58077d3c7e43986b6b15fba718e8ea69e387dfcc # v2.15.1 |
347 | | - with: |
348 | | - egress-policy: audit |
349 | | - |
350 | | - - name: Checkout code |
351 | | - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 |
352 | | - with: |
353 | | - fetch-depth: 0 |
354 | | - |
355 | | - - name: Setup Node.js |
356 | | - uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0 |
357 | | - with: |
358 | | - node-version: '20.x' |
359 | | - |
360 | | - - name: Sync CHANGELOG.md from GitHub releases |
361 | | - env: |
362 | | - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
363 | | - run: node scripts/sync-changelog.js |
364 | | - |
365 | | - - name: Check for changes |
366 | | - id: changes |
367 | | - run: | |
368 | | - if git diff --quiet CHANGELOG.md; then |
369 | | - echo "changed=false" >> $GITHUB_OUTPUT |
370 | | - echo "ℹ️ No changes needed" |
371 | | - else |
372 | | - echo "changed=true" >> $GITHUB_OUTPUT |
373 | | - echo "Changes detected in CHANGELOG.md" |
374 | | - fi |
375 | | -
|
376 | | - - name: Create Pull Request |
377 | | - if: steps.changes.outputs.changed == 'true' |
378 | | - uses: peter-evans/create-pull-request@c0f553fe549906ede9cf27b5156039d195d2ece0 # v8.1.0 |
379 | | - with: |
380 | | - branch: update-changelog |
381 | | - title: "docs: sync CHANGELOG.md with v${{ needs.release.outputs.version }} release notes" |
382 | | - body: | |
383 | | - Automatically syncs CHANGELOG.md with the latest GitHub release notes. |
384 | | - |
385 | | - Triggered by release workflow: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} |
386 | | - commit-message: "docs: sync CHANGELOG.md with GitHub release notes" |
387 | 367 |
|
388 | | - - name: Changelog Summary |
389 | | - if: always() |
390 | | - run: | |
391 | | - echo "# 📝 Changelog Update" >> $GITHUB_STEP_SUMMARY |
392 | | - echo "" >> $GITHUB_STEP_SUMMARY |
393 | | - if [ "${{ steps.changes.outputs.changed }}" == "true" ]; then |
394 | | - echo "A pull request has been created to update CHANGELOG.md." >> $GITHUB_STEP_SUMMARY |
395 | | - else |
396 | | - echo "CHANGELOG.md is already up to date." >> $GITHUB_STEP_SUMMARY |
397 | | - fi |
0 commit comments