update README.md #21
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 | |
on: | |
push: | |
branches: ['*'] | |
tags: ['v*'] | |
pull_request: | |
permissions: {} | |
defaults: | |
run: | |
shell: bash | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
permissions: | |
id-token: write | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: cachix/install-nix-action@v21 | |
- name: Extract Tag | |
id: extract_tag | |
uses: actions/github-script@v6 | |
with: | |
script: | | |
const prefix = 'refs/tags/v'; | |
const ref = context.ref; | |
return ref.startsWith(prefix) ? ref.substring(prefix.length) : ''; | |
result-encoding: string | |
- name: Lint | |
run: nix develop --command make lint | |
- name: Check Format | |
run: nix develop --command make fmt-check | |
- name: Run Tests | |
run: nix develop --command make test | |
- name: Prepare for NPM | |
run: nix develop --command make "npm/${{ steps.extract_tag.outputs.result || '0.0.0' }}" | |
- name: Publish to NPM | |
if: steps.extract_tag.outputs.result | |
env: | |
TAG: ${{ steps.extract_tag.outputs.result }} | |
run: | | |
nix develop --command npm config set //registry.npmjs.org/:_authToken "${{ secrets.NPM_TOKEN }}" | |
nix develop --command npm publish npm/ --provenance --access public |