refactor(script): debug in production friendly scripts setup #16
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 to GitHub Packages | |
on: | |
push: | |
branches: | |
- main | |
- boilerplate | |
jobs: | |
build-and-publish: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Setup Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '18' | |
- uses: pnpm/action-setup@v4 | |
with: | |
version: 9 | |
- name: Install dependencies | |
run: pnpm install | |
- name: Run tests | |
run: pnpm test | |
- name: Build project | |
run: pnpm build | |
- name: Configure npm registry | |
run: | | |
echo "//npm.pkg.github.com/:_authToken=${{ secrets.GITHUB_TOKEN }}" > .npmrc | |
echo "node-bin-path=$(which node)" >> .npmrc | |
echo "registry=https://npm.pkg.github.com/" >> .npmrc | |
- name: Publish to GitHub Packages | |
if: github.ref == 'refs/heads/boilerplate' | |
run: pnpm publish --access public --no-git-checks | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |