Update README.md #20
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: CI/CD | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
# Allow manual trigger | |
workflow_dispatch: | |
jobs: | |
test: | |
name: Test Extension | |
runs-on: windows-latest | |
timeout-minutes: 15 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '20' | |
cache: 'pnpm' | |
- name: Install pnpm | |
uses: pnpm/action-setup@v2 | |
with: | |
version: 8 | |
run_install: false | |
- name: Get pnpm store directory | |
shell: bash | |
run: | | |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_ENV | |
- name: Cache pnpm modules | |
uses: actions/cache@v3 | |
with: | |
path: ${{ env.STORE_PATH }} | |
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} | |
restore-keys: | | |
${{ runner.os }}-pnpm-store- | |
- name: Install dependencies | |
run: pnpm install | |
- name: Run Tests | |
run: | | |
pnpm test | |
env: | |
NODE_OPTIONS: --force-node-api-uncaught-exceptions-policy=true | |
DISPLAY: :99.0 | |
publish: | |
name: Publish Extension | |
needs: test # Only run if tests pass | |
if: github.ref == 'refs/heads/main' && github.event_name == 'push' | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '20' | |
cache: 'pnpm' | |
- name: Install pnpm | |
uses: pnpm/action-setup@v2 | |
with: | |
version: 8 | |
run_install: false | |
- name: Install dependencies | |
run: pnpm install | |
- name: Build Extension | |
run: pnpm run build | |
- name: Publish to Visual Studio Marketplace | |
if: success() | |
run: | | |
pnpm vsce publish -p ${{ secrets.VSCE_PAT }} | |
env: | |
VSCE_PAT: ${{ secrets.VSCE_PAT }} |