fix github actions #15
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: Test and maybe publish | |
on: | |
push: | |
branches: | |
- master | |
jobs: | |
publish: | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 16 | |
- uses: pnpm/[email protected] | |
with: | |
version: 7 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 16 | |
cache: "pnpm" | |
- run: pnpm install | |
- name: Test and build | |
run: pnpm exec run-p --print-label build 'test:!(tsc)' | |
- id: publish | |
uses: JS-DevTools/npm-publish@v1 | |
with: | |
token: ${{ secrets.NPM_TOKEN }} | |
- name: Add tag | |
if: steps.publish.outputs.type != 'none' | |
uses: actions/github-script@v5 | |
with: | |
script: | | |
github.rest.git.createRef({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
ref: 'refs/tags/v${{ steps.publish.outputs.version }}', | |
sha: context.sha | |
}) |