Skip to content

Commit

Permalink
Updating th CI to publish the extension when a branch is merged into …
Browse files Browse the repository at this point in the history
…main
  • Loading branch information
jamiehewitt15 committed Mar 5, 2025
1 parent 00c5506 commit 2768bda
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 1 deletion.
37 changes: 37 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Add this to your existing ci.yml file

name: CI

on:
push:
branches: [main]
pull_request:
branches: [main]

jobs:
build:
runs-on: ubuntu-latest
env:
VSCE_PAT: ${{ secrets.VSCE_PAT }}
steps:
- uses: actions/checkout@v3

- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '20.16.0'

- name: Install dependencies
run: npm ci

- name: Test ## It's good to double check the tests are passing before publishing
run: npm run test

# Only run publish step when pushing to main (not on PRs)
- name: Publish to VS Code Marketplace
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
run: |
# Extract version from package.json to use in the vsix filename
VERSION=$(node -p "require('./package.json').version")
npm run build
npx vsce publish -p ${{ secrets.VSCE_PAT }}
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@
"test": "vscode-test --extensionDevelopmentPath=. --extensionTestsPath=out/test/extension.test.js",
"pretest": "npm run compile-tests",
"posttest": "npm run lint",
"build": "npx vsce package"
"build": "npx vsce package",
"publish": "npx vsce publish"
},
"devDependencies": {
"@types/chai": "^5.0.0",
Expand Down

0 comments on commit 2768bda

Please sign in to comment.