Mutual Authentication and Service Monetization Framework #943
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
on: [push, pull_request] | |
name: Build and Test | |
jobs: | |
test: | |
name: Build & Test | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: [18.x, 20.x, 22.x] | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v1 | |
with: | |
node-version: ${{ matrix.node-version }} | |
- name: Cache node_modules | |
id: cache-modules | |
uses: actions/cache@v1 | |
with: | |
path: node_modules | |
key: ${{ matrix.node-version }}-${{ runner.OS }}-build-${{ hashFiles('package.json') }} | |
- name: Build | |
if: steps.cache-modules.outputs.cache-hit != 'true' | |
run: npm install | |
- name: Test | |
run: npm run test | |
publish: | |
name: Publish | |
needs: test | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
id-token: write | |
if: github.event_name == 'push' && github.ref == 'refs/heads/master' | |
steps: | |
- name: Authenticate with registry | |
run: echo "//registry.npmjs.org/:_authToken=$NODE_AUTH_TOKEN" > ~/.npmrc | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.BSV_NPM_TOKEN }} | |
- uses: actions/checkout@v3 | |
- name: Use Node.js 20.x | |
uses: actions/setup-node@v1 | |
with: | |
node-version: 20.x | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.BSV_NPM_TOKEN }} | |
- name: Cache node_modules | |
id: cache-modules | |
uses: actions/cache@v3 | |
with: | |
path: node_modules | |
key: 20.x-${{ runner.OS }}-build-${{ hashFiles('package.json') }} | |
- name: Install deps | |
if: steps.cache-modules.outputs.cache-hit != 'true' | |
run: npm install | |
- name: Build | |
run: npm run build | |
- name: Publish to NPM (expected to fail if version was not bumped manually) | |
run: npm publish --provenance --access public | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.BSV_NPM_TOKEN }} |