bump #89
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: build & npm | |
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: Check commit message | |
id: check-commit | |
run: echo "::set-output name=publish::$(echo '${{ github.event.head_commit.message }}' | grep -i '[publish]' || echo '')" | |
- name: Configure npmjs registry | |
if: startsWith(github.ref, 'refs/heads/boilerplate') || steps.check-commit.outputs.publish | |
run: | | |
echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > .npmrc | |
echo "node-bin-path=$(which node)" >> .npmrc | |
- name: Publish to npmjs | |
if: startsWith(github.ref, 'refs/heads/boilerplate') || steps.check-commit.outputs.publish | |
run: pnpm publish --access public --no-git-checks | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
- name: Configure GitHub Packages registry | |
if: startsWith(github.ref, 'refs/heads/boilerplate') || steps.check-commit.outputs.publish | |
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: startsWith(github.ref, 'refs/heads/boilerplate') || steps.check-commit.outputs.publish | |
run: pnpm publish --access public --no-git-checks | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |