Publish VS Code Extension #2
This file contains 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 VS Code Extension | |
on: | |
create: | |
tags: | |
- 'v*' # Trigger on creating version tags (e.g., v1.0.0) | |
jobs: | |
publish: | |
runs-on: ubuntu-latest | |
steps: | |
# Step 1: Checkout the repository | |
- name: Check out the code | |
uses: actions/checkout@v3 | |
# Step 2: Set up Node.js environment | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '18' # Use Node version compatible with vsce | |
# Step 3: Install vsce globally | |
- name: Install vsce | |
run: npm install -g vsce | |
# step 3.5: install packages | |
- name: Install dependencies | |
run: npm install | |
# Step 4: Authenticate using your Personal Access Token (PAT) | |
- name: Authenticate with the Visual Studio Marketplace | |
env: | |
VSCE_PAT: ${{ secrets.VSCE_PAT }} | |
run: echo "//vsce.dev/_authToken=$VSCE_PAT" > ~/.npmrc | |
# Step 5: Run vsce publish to publish the extension | |
- name: Publish the Extension | |
env: | |
VSCE_PAT: ${{ secrets.VSCE_PAT }} | |
run: vsce publish | |