diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index a94e7cbe..bf34396a 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -41,3 +41,34 @@ 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] + concurrency: + group: preview-marketplace + cancel-in-progress: true + permissions: + contents: read + env: + VSCE_PAT: ${{ secrets.VSCE_PAT }} + 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 + 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",