Package and Publish Extension #3
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: Package and Publish Extension | |
| on: | |
| # Trigger on version tags (e.g., v0.1.0, v1.2.3) | |
| push: | |
| tags: | |
| - "v*.*.*" | |
| # Allow manual trigger from GitHub UI | |
| workflow_dispatch: | |
| jobs: | |
| package: | |
| name: Package Extension | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: "20" | |
| - name: Install vsce | |
| run: npm install -g vsce | |
| - name: Package extension | |
| run: vsce package | |
| - name: Upload VSIX artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: vscode-extension | |
| path: "*.vsix" | |
| publish: | |
| name: Publish to Marketplace | |
| runs-on: ubuntu-latest | |
| needs: package | |
| # Only publish on tag pushes (not manual triggers) | |
| if: startsWith(github.ref, 'refs/tags/') | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: "20" | |
| - name: Install vsce | |
| run: npm install -g vsce | |
| - name: Package extension for release | |
| run: | | |
| mkdir -p release | |
| vsce package --out release/vscode-usecode-syntax.vsix | |
| - name: Publish to VS Code Marketplace | |
| env: | |
| VSCE_TOKEN: ${{ secrets.VSCE_TOKEN }} | |
| run: vsce publish --pat "$VSCE_TOKEN" | |
| - name: Create GitHub Release | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| files: 'release/vscode-usecode-syntax.vsix' | |
| generate_release_notes: true | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |