Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit bfaf0cf

Browse filesBrowse files
fix: prevent tag conflict by using @semantic-release/exec for webview sync
## Problem Semantic Release was creating tags on commit A, then GitHub Actions was amending the commit to add webview package changes, creating commit B. This caused the tag to point to the wrong commit, leading to "tag already exists" errors on subsequent releases. ## Root Cause The workflow had a separate step that ran AFTER Semantic Release to sync webview/package.json. This step used `git commit --amend --force` which changed the commit SHA, making the already-created tag point to a non-existent commit. Flow was: 1. Semantic Release creates commit A and tag v2.1.0 → A 2. Webview sync amends A to create commit B 3. Tag v2.1.0 still points to A (which no longer exists in history) 4. Next release: tag v2.1.0 exists but not in production branch → conflict ## Solution Use `@semantic-release/exec` plugin's `prepareCmd` hook to update webview files BEFORE Semantic Release creates the commit and tag. This ensures: 1. All version updates (root + webview) happen in prepare phase 2. Semantic Release commits everything in one atomic commit 3. Tag is created on the correct, final commit 4. No commit amendment needed ## Changes 1. **package.json**: Add `@semantic-release/exec` dependency 2. **.releaserc.json**: Add `@semantic-release/exec` plugin before `@semantic-release/git` - prepareCmd: `cd src/webview && npm version ${nextRelease.version} --no-git-tag-version --allow-same-version && npm install` 3. **release.yml**: Remove "Sync webview package.json version" step (no longer needed) ## Plugin Execution Order 1. @semantic-release/commit-analyzer - Determine version bump 2. @semantic-release/release-notes-generator - Generate changelog 3. @semantic-release/changelog - Write CHANGELOG.md 4. @semantic-release/npm - Update root package.json 5. **@semantic-release/exec** - Update webview package.json + package-lock.json ← NEW 6. @semantic-release/git - Commit all changes + create tag 7. @semantic-release/github - Create GitHub release ## Testing This fix will be validated on the next release. Expected behavior: - Single commit with all version changes - Tag points to the correct commit - No "tag already exists" errors
1 parent fb8f793 commit bfaf0cf
Copy full SHA for bfaf0cf

4 files changed

+193-21Lines changed: 193 additions & 21 deletions

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎.github/workflows/release.yml‎

Copy file name to clipboardExpand all lines: .github/workflows/release.yml
-21Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -46,27 +46,6 @@ jobs:
4646
GIT_COMMITTER_EMAIL: github-actions[bot]@users.noreply.github.com
4747
run: npx semantic-release
4848

49-
- name: Sync webview package.json version
50-
if: steps.semantic_release.outcome == 'success'
51-
env:
52-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
53-
run: |
54-
# Get the new version from semantic-release
55-
NEW_VERSION=$(node -p "require('./package.json').version")
56-
57-
# Update webview package.json
58-
cd src/webview
59-
npm version $NEW_VERSION --no-git-tag-version --allow-same-version
60-
npm install
61-
62-
# Commit the webview version sync
63-
cd ../..
64-
git config user.name "github-actions[bot]"
65-
git config user.email "github-actions[bot]@users.noreply.github.com"
66-
git add src/webview/package.json src/webview/package-lock.json
67-
git commit --amend --no-edit
68-
git push https://x-access-token:${GITHUB_TOKEN}@github.com/${{ github.repository }}.git HEAD:${{ github.ref }} --force
69-
7049
- name: Build extension with new version
7150
if: steps.semantic_release.outcome == 'success'
7251
run: npm run build
Collapse file

‎.releaserc.json‎

Copy file name to clipboardExpand all lines: .releaserc.json
+6Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,12 @@
5454
"npmPublish": false
5555
}
5656
],
57+
[
58+
"@semantic-release/exec",
59+
{
60+
"prepareCmd": "cd src/webview && npm version ${nextRelease.version} --no-git-tag-version --allow-same-version && npm install"
61+
}
62+
],
5763
[
5864
"@semantic-release/git",
5965
{
Collapse file

‎package-lock.json‎

Copy file name to clipboardExpand all lines: package-lock.json
+186Lines changed: 186 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Collapse file

‎package.json‎

Copy file name to clipboardExpand all lines: package.json
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@
8080
"devDependencies": {
8181
"@biomejs/biome": "2.3.4",
8282
"@semantic-release/changelog": "^6.0.3",
83+
"@semantic-release/exec": "^7.1.0",
8384
"@semantic-release/git": "^10.0.1",
8485
"@types/node": "^24.10.0",
8586
"@types/vscode": "^1.80.0",

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.