v0.3.0 #5
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Publish to Marketplace | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| version: | |
| description: "Version to publish (e.g., 0.1.0)" | |
| required: true | |
| type: string | |
| release: | |
| types: [published] | |
| jobs: | |
| build: | |
| name: Build Extension | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: "20" | |
| cache: "npm" | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Compile extension | |
| run: npm run compile | |
| - name: Lint | |
| run: npm run lint | |
| - name: Type check | |
| run: npx tsc --noEmit | |
| - name: Format check | |
| run: npm run format:check | |
| - name: Smoke test | |
| run: npm run smoke | |
| - name: Verify version matches package.json | |
| if: github.event_name == 'workflow_dispatch' | |
| run: | | |
| PACKAGE_VERSION=$(node -p "require('./package.json').version") | |
| INPUT_VERSION="${{ github.event.inputs.version }}" | |
| if [ "$PACKAGE_VERSION" != "$INPUT_VERSION" ]; then | |
| echo "Error: package.json version ($PACKAGE_VERSION) does not match input version ($INPUT_VERSION)" | |
| exit 1 | |
| fi | |
| - name: Verify tag matches package.json | |
| if: github.event_name == 'release' | |
| run: | | |
| PACKAGE_VERSION=$(node -p "require('./package.json').version") | |
| TAG_VERSION="${{ github.event.release.tag_name }}" | |
| TAG_VERSION=${TAG_VERSION#v} | |
| if [ "$PACKAGE_VERSION" != "$TAG_VERSION" ]; then | |
| echo "Error: package.json version ($PACKAGE_VERSION) does not match tag version ($TAG_VERSION)" | |
| exit 1 | |
| fi | |
| - name: Package extension | |
| run: npx vsce package --allow-missing-repository | |
| - name: Upload VSIX artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: vsix-package | |
| path: "*.vsix" | |
| retention-days: 7 | |
| publish-vscode: | |
| name: Publish to VS Code Marketplace | |
| needs: build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Download VSIX artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: vsix-package | |
| - name: Install vsce | |
| run: npm install -g @vscode/vsce | |
| - name: Publish to VS Code Marketplace | |
| env: | |
| VSCE_PAT: ${{ secrets.VSCE_PAT }} | |
| run: | | |
| if [ -z "$VSCE_PAT" ]; then | |
| echo "Error: VSCE_PAT secret is not set" | |
| echo "Please create a Personal Access Token at https://dev.azure.com/_usersSettings/tokens" | |
| echo "Then add it as a secret named VSCE_PAT in your repository settings" | |
| exit 1 | |
| fi | |
| VSIX_FILE=$(ls *.vsix) | |
| vsce publish --packagePath "$VSIX_FILE" -p $VSCE_PAT | |
| publish-openvsx: | |
| name: Publish to Open VSX | |
| needs: build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Download VSIX artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: vsix-package | |
| - name: Install ovsx | |
| run: npm install -g ovsx | |
| - name: Publish to Open VSX | |
| env: | |
| OVSX_PAT: ${{ secrets.OVSX_PAT }} | |
| run: | | |
| if [ -z "$OVSX_PAT" ]; then | |
| echo "Error: OVSX_PAT secret is not set" | |
| echo "Please create a Personal Access Token at https://open-vsx.org/user-settings/tokens" | |
| echo "Then add it as a secret named OVSX_PAT in your repository settings" | |
| exit 1 | |
| fi | |
| VSIX_FILE=$(ls *.vsix) | |
| ovsx publish "$VSIX_FILE" -p $OVSX_PAT |