Skip to content

Configure NPM publishing with OIDC trusted publishers #10

Configure NPM publishing with OIDC trusted publishers

Configure NPM publishing with OIDC trusted publishers #10

name: Test and Publish
on:
push:
branches:
- master
pull_request:
branches:
- master
release:
types: [created]
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [14, 16]
steps:
- uses: actions/checkout@v3
- name: Setup Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'yarn'
- name: Install dependencies
run: yarn install --frozen-lockfile
- name: Run tests
run: yarn test
publish:
needs: test
runs-on: ubuntu-latest
if: github.event_name == 'release' && github.event.action == 'created'
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@v3
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '16'
registry-url: 'https://registry.npmjs.org'
cache: 'yarn'
- name: Install dependencies
run: yarn install --frozen-lockfile
- name: Build
run: yarn build
- name: Publish to NPM
run: npm publish --provenance --access public