Enable Corepack in GitHub Actions for Node package deploy #4
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: 'Package & Deploy to NPM ' | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
release: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Set up Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
cache: 'pnpm' | |
- run: corepack enable | |
- name: Install pnpm | |
uses: pnpm/action-setup@v2.2.4 | |
- name: Install dependencies | |
run: pnpm install | |
- name: Release | |
run: pnpm standard-version | |
env: | |
GITHUB_TOKEN: ${{ github.token }} | |
- name: Build project | |
run: pnpm run build | |
- name: Publish to NPM | |
run: pnpm publish --access public | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |