@@ -41,17 +41,18 @@ jobs:
4141 - name : Compute version
4242 id : version
4343 run : |
44- # Major.minor is read from apps/vscode/package.json (single source of truth).
45- # Patch is the GitHub Actions run_number for this workflow (monotonic, never resets).
46- MAJOR_MINOR=$(node -p "require('./apps/vscode/package.json').version.split('.').slice(0,2).join('.')")
47- VERSION="${MAJOR_MINOR}.${{ github.run_number }}"
44+ # Full version is read from apps/vscode/package.json (single source of truth).
45+ # Bump it in a commit before running this workflow.
46+ VERSION=$(node -p "require('./apps/vscode/package.json').version")
47+ TAG="vscode-v${VERSION}"
48+ if git rev-parse -q --verify "refs/tags/${TAG}" >/dev/null \
49+ || git ls-remote --exit-code --tags origin "refs/tags/${TAG}" >/dev/null 2>&1; then
50+ echo "::error::Tag ${TAG} already exists. Bump apps/vscode/package.json before releasing."
51+ exit 1
52+ fi
4853 echo "version=${VERSION}" >> "$GITHUB_OUTPUT"
49- echo "tag=vscode-v${VERSION}" >> "$GITHUB_OUTPUT"
50- echo "Computed version: ${VERSION}"
51-
52- - name : Apply version to manifest (workspace only, not committed)
53- working-directory : apps/vscode
54- run : npm version "${{ steps.version.outputs.version }}" --no-git-tag-version --allow-same-version
54+ echo "tag=${TAG}" >> "$GITHUB_OUTPUT"
55+ echo "Releasing version: ${VERSION}"
5556
5657 - name : Install dependencies
5758 run : pnpm install --frozen-lockfile
8990 - name : Tag the release commit
9091 if : ${{ !inputs.dry-run }}
9192 run : |
92- # Discard the in-workspace version bump so the tag points at the original commit.
93- git checkout apps/vscode/package.json
9493 git tag "${{ steps.version.outputs.tag }}"
9594 git push origin "${{ steps.version.outputs.tag }}"
9695
@@ -112,7 +111,6 @@ jobs:
112111 echo ""
113112 echo "- Version: \`${{ steps.version.outputs.version }}\`"
114113 echo "- Tag: \`${{ steps.version.outputs.tag }}\`"
115- echo "- Run number: \`${{ github.run_number }}\`"
116114 if [ "${{ inputs.dry-run }}" = "true" ]; then
117115 echo "- Mode: **dry-run** (nothing published, no tag pushed)"
118116 fi
0 commit comments