Skip to content

Publish to NPM Registry #3

Publish to NPM Registry

Publish to NPM Registry #3

name: Publish Library
run-name: Publish to NPM Registry
on:
push:
branches:
- master
jobs:
Info-And-Checkout:
runs-on: ubuntu-latest
steps:
- run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event."
- run: echo "🔎 The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}."
Lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
- name: Install and Lint
uses: actions/cache@v4
with:
path: "node_modules"
key: ${{ runner.arch }}-${{ runner.os }}-modules-${{ hashFiles('yarn.lock') }}
- run: |
yarn install --frozen-lockfile
yarn lint
Test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
- name: Install and Test
uses: actions/cache@v4
with:
path: "node_modules"
key: ${{ runner.arch }}-${{ runner.os }}-modules-${{ hashFiles('yarn.lock') }}
- run: |
yarn install --frozen-lockfile
yarn test
Publish-npm:
needs: [Lint, Test]
runs-on: ubuntu-latest
permissions:
id-token: write
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
registry-url: 'https://registry.npmjs.org'
- uses: actions/cache@v4
with:
path: "node_modules"
key: ${{ runner.arch }}-${{ runner.os }}-modules-${{ hashFiles('yarn.lock') }}
- run: yarn install --frozen-lockfile
- run: npm publish --provenance --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_K14V_PUBLISH_TOKEN }}