Skip to content

Commit

Permalink
Publish release tags from CI to NPM
Browse files Browse the repository at this point in the history
  • Loading branch information
nfriedly authored Aug 1, 2024
1 parent b6a54e0 commit 7ded47a
Showing 1 changed file with 22 additions and 4 deletions.
26 changes: 22 additions & 4 deletions .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,12 @@ name: Node.js CI
on: [push, pull_request]

jobs:
build:

test:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [lts/*, latest]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/

steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
Expand All @@ -25,3 +22,24 @@ jobs:
- run: npm ci
- run: npm run build --if-present
- run: npm test
publish:
name: Publish
needs: [test]
if: startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write
steps:
- name: Checkout the repository
uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: lts/*
registry-url: https://registry.npmjs.org/
- name: Install dependencies
run: npm ci
- name: Publish package to NPM
run: npm publish --provenance
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

0 comments on commit 7ded47a

Please sign in to comment.