From a8b3d95d6f14ecff9078da3f7743970c233b2efc Mon Sep 17 00:00:00 2001 From: Robby Thompson Date: Thu, 24 Sep 2026 10:57:02 -0500 Subject: [PATCH] ci: commit version bump before publishing so reruns don't recollide Move the version-bump commit ahead of the Open VSX and Marketplace publishes and tag only after a successful publish. Previously the bump was committed to main only at the very end, so any publish failure left main at the old version and every rerun recomputed the same version, colliding with an already-uploaded release. Advancing main first makes reruns pick the next version instead. Co-Authored-By: Claude Opus 4.8 --- .github/workflows/release.yml | 65 +++++++++++++++++++++-------------- 1 file changed, 39 insertions(+), 26 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index ca0fa04..cca2a7f 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -56,28 +56,12 @@ jobs: exit 1 fi - - name: Publish to Open VSX Registry - uses: HaaLeo/publish-vscode-extension@v2 - id: publishToOpenVSX - with: - pat: ${{ secrets.OPEN_VSX_TOKEN }} - dependencies: false - skipDuplicate: true - - - name: Publish to Visual Studio Marketplace - uses: HaaLeo/publish-vscode-extension@v2 - with: - pat: ${{ secrets.VS_MARKETPLACE_TOKEN }} - registryUrl: https://marketplace.visualstudio.com - extensionFile: ${{ steps.publishToOpenVSX.outputs.vsixPath }} - skipDuplicate: true - - - name: Commit version bump and tag through GitHub API + - name: Commit version bump + id: commit uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0 env: VERSION: ${{ steps.bump.outputs.version }} VERSION_FILES: ${{ steps.bump.outputs.files }} - VERSION_TAG: ${{ steps.bump.outputs.tag }} with: script: | const fs = require('fs') @@ -85,7 +69,6 @@ jobs: const { owner, repo } = context.repo const branch = context.ref.replace('refs/heads/', '') const files = JSON.parse(process.env.VERSION_FILES) - const tag = process.env.VERSION_TAG const version = process.env.VERSION if (files.length === 0) { @@ -133,16 +116,46 @@ jobs: }) const commit = result.createCommitOnBranch.commit + core.setOutput('sha', commit.oid) + core.info(`Committed ${commit.oid} to ${branch}`) + if (commit.signature) { + core.info(`Commit signature: signedByGitHub=${commit.signature.wasSignedByGitHub}, valid=${commit.signature.isValid}, state=${commit.signature.state}`) + } else { + core.warning('GitHub did not return signature details for the API-created commit.') + } + + - name: Publish to Open VSX Registry + uses: HaaLeo/publish-vscode-extension@v2 + id: publishToOpenVSX + with: + pat: ${{ secrets.OPEN_VSX_TOKEN }} + dependencies: false + skipDuplicate: true + + - name: Publish to Visual Studio Marketplace + uses: HaaLeo/publish-vscode-extension@v2 + with: + pat: ${{ secrets.VS_MARKETPLACE_TOKEN }} + registryUrl: https://marketplace.visualstudio.com + extensionFile: ${{ steps.publishToOpenVSX.outputs.vsixPath }} + skipDuplicate: true + + - name: Tag the published release + uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0 + env: + COMMIT_SHA: ${{ steps.commit.outputs.sha }} + VERSION_TAG: ${{ steps.bump.outputs.tag }} + with: + script: | + const { owner, repo } = context.repo + const tag = process.env.VERSION_TAG + const sha = process.env.COMMIT_SHA + await github.rest.git.createRef({ owner, repo, ref: `refs/tags/${tag}`, - sha: commit.oid + sha }) - core.info(`Created ${commit.oid} and ${tag}`) - if (commit.signature) { - core.info(`Commit signature: signedByGitHub=${commit.signature.wasSignedByGitHub}, valid=${commit.signature.isValid}, state=${commit.signature.state}`) - } else { - core.warning('GitHub did not return signature details for the API-created commit.') - } + core.info(`Created tag ${tag} at ${sha}`)