From e2119e328ef1341ba9f0e54092cad93106322fe1 Mon Sep 17 00:00:00 2001 From: Muhammad Atif Ali Date: Fri, 8 Aug 2025 16:36:42 +0500 Subject: [PATCH 1/4] ci: publish prerelease to marketplace on main merges - Add preview job to `ci.yaml` to package and publish pre-release using vsce - Trigger only on pushes to `main` when `VSCE_PAT` is set - Keeps stable releases in `release.yaml` Refs: #97 --- .github/workflows/ci.yaml | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index a94e7cbe..aaec6866 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -41,3 +41,31 @@ jobs: - run: yarn - run: yarn test:ci + + preview: + name: preview prerelease (marketplace) + if: github.event_name == 'push' && github.ref == 'refs/heads/main' && secrets.VSCE_PAT != '' + runs-on: ubuntu-22.04 + needs: [lint, test] + permissions: + contents: read + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-node@v4 + with: + node-version: "22" + + - run: yarn + + - name: Compute prerelease version + id: version + run: | + BASE_VERSION=$(node -p "require('./package.json').version") + SHORT_SHA=${GITHUB_SHA::7} + echo "value=${BASE_VERSION}-pre.${GITHUB_RUN_NUMBER}.${SHORT_SHA}" >> $GITHUB_OUTPUT + + - name: Publish prerelease to VS Code Marketplace + env: + VSCE_PAT: ${{ secrets.VSCE_PAT }} + run: npx vsce publish --pre-release --no-git-tag-version ${{ steps.version.outputs.value }} From da758cfe2ab542b4b00c0ed438a599e5b4c19278 Mon Sep 17 00:00:00 2001 From: Muhammad Atif Ali Date: Fri, 8 Aug 2025 16:41:38 +0500 Subject: [PATCH 2/4] ci: harden prerelease publish job - Proper job-level if expression using env var - Add concurrency to avoid overlapping publishes - Remove invalid vsce flag; pass version explicitly Refs: #97 --- .github/workflows/ci.yaml | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index aaec6866..9217f6a5 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -44,11 +44,16 @@ jobs: preview: name: preview prerelease (marketplace) - if: github.event_name == 'push' && github.ref == 'refs/heads/main' && secrets.VSCE_PAT != '' + if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' && env.VSCE_PAT != '' }} runs-on: ubuntu-22.04 needs: [lint, test] + concurrency: + group: preview-marketplace + cancel-in-progress: true permissions: contents: read + env: + VSCE_PAT: ${{ secrets.VSCE_PAT }} steps: - uses: actions/checkout@v4 @@ -66,6 +71,4 @@ jobs: echo "value=${BASE_VERSION}-pre.${GITHUB_RUN_NUMBER}.${SHORT_SHA}" >> $GITHUB_OUTPUT - name: Publish prerelease to VS Code Marketplace - env: - VSCE_PAT: ${{ secrets.VSCE_PAT }} - run: npx vsce publish --pre-release --no-git-tag-version ${{ steps.version.outputs.value }} + run: npx vsce publish --pre-release ${{ steps.version.outputs.value }} From 567e8c461bcc52f0fad1e7cf254c7d48f200dfe7 Mon Sep 17 00:00:00 2001 From: Muhammad Atif Ali Date: Fri, 8 Aug 2025 16:53:13 +0500 Subject: [PATCH 3/4] ci: ensure vsce uses computed prerelease version - Guard on secret directly in job condition - Bump package.json version in CI to align with computed prerelease - Publish with vsce --pre-release without explicit version arg Refs: #97 --- .github/workflows/ci.yaml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 9217f6a5..a4771c56 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -44,7 +44,7 @@ jobs: preview: name: preview prerelease (marketplace) - if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' && env.VSCE_PAT != '' }} + if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' && secrets.VSCE_PAT != '' }} runs-on: ubuntu-22.04 needs: [lint, test] concurrency: @@ -70,5 +70,8 @@ jobs: SHORT_SHA=${GITHUB_SHA::7} echo "value=${BASE_VERSION}-pre.${GITHUB_RUN_NUMBER}.${SHORT_SHA}" >> $GITHUB_OUTPUT + - name: Update package.json version + run: npm version "${{ steps.version.outputs.value }}" --no-git-tag-version + - name: Publish prerelease to VS Code Marketplace - run: npx vsce publish --pre-release ${{ steps.version.outputs.value }} + run: npx vsce publish --pre-release From 282d88040accffa1e4bb1d95b6dd73cd38f74769 Mon Sep 17 00:00:00 2001 From: Muhammad Atif Ali Date: Fri, 8 Aug 2025 17:03:19 +0500 Subject: [PATCH 4/4] ci/release: use yarn for vsce invocations - Replace npx vsce with yarn vsce in workflows - Update package script to use yarn Refs: #97 --- .github/workflows/ci.yaml | 5 +---- .github/workflows/release.yaml | 2 +- package.json | 2 +- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index a4771c56..bf34396a 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -70,8 +70,5 @@ jobs: SHORT_SHA=${GITHUB_SHA::7} echo "value=${BASE_VERSION}-pre.${GITHUB_RUN_NUMBER}.${SHORT_SHA}" >> $GITHUB_OUTPUT - - name: Update package.json version - run: npm version "${{ steps.version.outputs.value }}" --no-git-tag-version - - name: Publish prerelease to VS Code Marketplace - run: npx vsce publish --pre-release + run: yarn vsce publish --pre-release ${{ steps.version.outputs.value }} diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 756a2eaa..4c5ef297 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -22,7 +22,7 @@ jobs: - run: yarn - - run: npx vsce package + - run: yarn vsce package - uses: "marvinpinto/action-automatic-releases@latest" with: diff --git a/package.json b/package.json index e2886fcf..ac537113 100644 --- a/package.json +++ b/package.json @@ -23,7 +23,7 @@ "lint": "eslint . --ext ts,md,json", "lint:fix": "yarn lint --fix", "package": "webpack --mode production --devtool hidden-source-map", - "package:prerelease": "npx vsce package --pre-release", + "package:prerelease": "yarn vsce package --pre-release", "pretest": "tsc -p . --outDir out && yarn run build && yarn run lint", "test": "vitest", "test:ci": "CI=true yarn test",