Skip to content

Commit ce6d361

Browse files
ARHAEEMclaude
andcommitted
fix(ci): make release tag source of truth for extension version
The publish workflow now writes the tag version into package.json before building, instead of verifying they match. This eliminates version mismatch errors when the developer forgets to bump package.json before creating a release. To publish: create a GitHub Release with tag extension/vX.Y.Z. The tag version is automatically written to package.json. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent a7994cb commit ce6d361

1 file changed

Lines changed: 12 additions & 5 deletions

File tree

.github/workflows/publish-extension.yml

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,21 @@ jobs:
3939
cache: 'pnpm'
4040
- run: pnpm install --frozen-lockfile
4141
- run: pnpm install -wD @vscode/vsce ovsx
42-
- name: Verify version matches tag
42+
- name: Set version from tag
4343
if: github.event_name == 'release'
4444
run: |
4545
TAG_VERSION="${GITHUB_REF_NAME#extension/v}"
46-
PKG_VERSION=$(node -p "require('./packages/extension/package.json').version")
47-
if [ "$TAG_VERSION" != "$PKG_VERSION" ]; then
48-
echo "Tag ($TAG_VERSION) != package.json ($PKG_VERSION)" && exit 1
49-
fi
46+
echo "Publishing extension v${TAG_VERSION}"
47+
# Write tag version into package.json — tag is source of truth
48+
node -e "
49+
const fs = require('fs');
50+
const p = './packages/extension/package.json';
51+
const pkg = JSON.parse(fs.readFileSync(p, 'utf8'));
52+
pkg.version = '${TAG_VERSION}';
53+
fs.writeFileSync(p, JSON.stringify(pkg, null, 2) + '\n');
54+
"
55+
echo "version=${TAG_VERSION}" >> $GITHUB_OUTPUT
56+
id: version
5057
- run: pnpm build
5158
- run: pnpm test
5259
- run: pnpm -F airtable-formula run package:vsix

0 commit comments

Comments
 (0)