generated from cloud-native-toolkit/template-typescript-library
-
Notifications
You must be signed in to change notification settings - Fork 8
41 lines (35 loc) · 1.08 KB
/
npm-publish.yaml
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
name: NPM publish
on:
release:
types: [published]
jobs:
notify:
runs-on: ubuntu-latest
steps:
- name: Setup variables
id: variables
shell: bash
env:
TAG_NAME: ${{ github.event.release.tag_name }}
run: |
# If the git tag name contains the word "beta" then make this a beta release in the npm registry
if [[ "${TAG_NAME}" =~ beta ]]; then
echo "NPM_TAG=--tag beta" >> $GITHUB_OUTPUT
fi
- uses: actions/checkout@v4
with:
ref: ${{ github.event.release.tag_name }}
- uses: actions/setup-node@v4
with:
node-version: '16'
registry-url: https://registry.npmjs.org/
- name: Publish to npm
run: |
npm ci
npm run build
echo "Publishing package: npm publish --access public ${TAG_NAME}"
npm publish --access public ${TAG_NAME}
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
TAG_NAME: ${{ steps.variables.outputs.NPM_TAG }}