-
Notifications
You must be signed in to change notification settings - Fork 1
42 lines (38 loc) · 1.12 KB
/
npm_release.yml
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
33
34
35
36
37
38
39
40
41
42
name: 'NPM CI+CD'
on:
release:
types: [published]
jobs:
build:
name: 'Build & Publish'
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
with:
ref: ${{ github.ref }}
- name: Update Package to Release version
uses: technote-space/[email protected]
- name: Check NPM secret presence
id: checksecrets
shell: bash
run: |
if [ "$SECRET" == "" ]; then
echo "secretspresent=false" >> $GITHUB_OUTPUT
else
echo "secretspresent=true" >> $GITHUB_OUTPUT
fi
env:
SECRET: ${{ secrets.NPM_TOKEN }}
- uses: actions/[email protected]
if: ${{ steps.checksecrets.outputs.secretspresent }}
with:
node-version: 20
- name: Publish to NPM
if: ${{ steps.checksecrets.outputs.secretspresent }}
continue-on-error: false
run: |
npm config set //registry.npmjs.org/:_authToken ${NPM_TOKEN}
npm install
npm publish --access public
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}