-
Notifications
You must be signed in to change notification settings - Fork 0
58 lines (48 loc) · 1.43 KB
/
package-publish.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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
name: Publish Package
on:
push:
branches: [dist]
release:
types: [published]
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
GITHUB_ACTIONS: true
NODE_VERSION: 22
PNPM_VERSION: 9
jobs:
publish:
name: Publish to npm registry
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ env.NODE_VERSION }}
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
registry-url: 'https://registry.npmjs.org'
- name: Export tag env var
run: |
SHORT_SHA=${GITHUB_SHA::7}
echo "NPM_TAG=`echo '0.0.0-dist.'$SHORT_SHA`" >> $GITHUB_ENV
- name: Publish ${NPM_TAG} to npm registry
if: github.event_name == 'push'
run: |
npm config set git-tag-version false
npm version ${NPM_TAG}
npm publish --access public --tag rc
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
- name: Publish ${{ github.ref_name }} to npm registry
if: github.event_name == 'release'
run: |
npm config set allow-same-version true
npm config set git-tag-version false
npm version ${{ github.ref_name }}
npm publish --access public --tag latest
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}