fix: Adding pnpm caching to build process #3
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 | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
branches: [main] | |
# This is to catch new releases of VS Code which could cause the extension to break | |
# Check every Sunday at 12 AM | |
schedule: | |
- cron: 0 0 * * 0 | |
jobs: | |
test: | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [macos-latest, ubuntu-latest, windows-latest] | |
vscode-version: ["1.81.0", stable] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Install Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18.x | |
- 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 --silent)" >> $GITHUB_ENV | |
- uses: actions/cache@v3 | |
name: Setup pnpm cache | |
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 | |
env: | |
npm_config_arch: x64 | |
- name: Test with VS Code ${{ matrix.vscode-version }} | |
uses: coactions/setup-xvfb@v1 | |
env: | |
VSCODE_TEST_VERSION: ${{ matrix.vscode-version }} | |
with: | |
run: pnpm test | |
build: | |
permissions: | |
contents: write | |
packages: write | |
if: github.event_name == 'push' | |
strategy: | |
matrix: | |
os: [macos-latest, ubuntu-latest, windows-latest] | |
runs-on: ${{ matrix.os }} | |
# needs: test | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Install Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18.x | |
- 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 --silent)" >> $GITHUB_ENV | |
- uses: actions/cache@v3 | |
name: Setup pnpm cache | |
with: | |
path: ${{ env.STORE_PATH }} | |
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} | |
restore-keys: | | |
${{ runner.os }}-pnpm-store- | |
- name: Install dependencies (without binaries) | |
run: | | |
pnpm install | |
- run: npx semantic-release --extends ./package.release.config.js | |
env: | |
GITHUB_TOKEN: ${{ secrets.REPO_ACCESS_TOKEN }} | |
VSCE_PAT: ${{ secrets.VSCE_PAT }} | |
- uses: actions/upload-artifact@v3 | |
with: | |
path: "*.vsix" | |
release: | |
permissions: | |
contents: write | |
packages: write | |
if: github.event_name == 'push' | |
runs-on: ubuntu-latest | |
needs: [build] # needs: [test, build] | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 18.x | |
- 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 --silent)" >> $GITHUB_ENV | |
- uses: actions/cache@v3 | |
name: Setup pnpm cache | |
with: | |
path: ${{ env.STORE_PATH }} | |
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} | |
restore-keys: | | |
${{ runner.os }}-pnpm-store- | |
- run: pnpm install | |
- uses: actions/download-artifact@v3 | |
- run: npx semantic-release --extends ./publish.release.config.js | |
if: github.event_name == 'push' || github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository | |
env: | |
GITHUB_TOKEN: ${{ secrets.REPO_ACCESS_TOKEN }} | |
VSCE_PAT: ${{ secrets.VSCE_PAT }} |