-
Notifications
You must be signed in to change notification settings - Fork 13
32 lines (32 loc) · 1.09 KB
/
npm.yml
File metadata and controls
32 lines (32 loc) · 1.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
name: Publish to NPM
on:
push:
branches:
- main
paths-ignore:
- 'docs/**'
jobs:
build:
runs-on: ubuntu-latest
# use 'if' to prevent endless looping with npm package commit
if: "!startsWith(github.event.head_commit.message, '[RELEASE]')"
steps:
- uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
- run: git config user.email "$GITHUB_ACTOR@users.noreply.github.com"
- run: git config user.name "$GITHUB_ACTOR"
# prepend '[RELEASE]' so that it can be detected above to prevent looping
# this is a commit to main that can be ignored by this GitHub action
# use 'patch' to update only the last digit in the version (e.g. 1.1.?)
# - run: npm version patch -m "[RELEASE] %s"
# - run: git push
# Setup .npmrc file to publish to npm
- uses: actions/setup-node@v4
with:
node-version: '20.x'
registry-url: 'https://registry.npmjs.org'
- run: npm ci
- run: npm publish --access=public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}