-
Notifications
You must be signed in to change notification settings - Fork 0
68 lines (57 loc) · 1.88 KB
/
Copy pathpublish.yml
File metadata and controls
68 lines (57 loc) · 1.88 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
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
59
60
61
62
63
64
65
66
67
68
name: Publish
on:
workflow_run:
workflows: [CI]
types: [completed]
branches: [main]
permissions:
contents: read
jobs:
publish:
name: publish
if: >-
github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.event == 'push'
runs-on: ubuntu-latest
timeout-minutes: 15
concurrency:
group: npm-publish
cancel-in-progress: false
permissions:
contents: read
id-token: write
steps:
- name: Checkout verified commit
uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
with:
ref: ${{ github.event.workflow_run.head_sha }}
persist-credentials: false
- name: Setup Node.js
uses: actions/setup-node@249970729cb0ef3589644e2896645e5dc5ba9c38 # v6
with:
node-version-file: .node-version
package-manager-cache: false
- name: Select stable release
id: release
run: |
version="$(node -p "require('./package.json').version")"
if [[ "${version}" == *-* ]]; then
echo "publish=false" >> "${GITHUB_OUTPUT}"
echo "Skip prerelease version ${version}."
exit 0
fi
echo "publish=true" >> "${GITHUB_OUTPUT}"
- name: Setup pnpm
if: steps.release.outputs.publish == 'true'
uses: pnpm/action-setup@0977fd99725f1db4007ccb2928dbb4e90d06cc86 # v6
- name: Install dependencies
if: steps.release.outputs.publish == 'true'
run: pnpm install --frozen-lockfile
- name: Build package
if: steps.release.outputs.publish == 'true'
run: pnpm build
- name: Publish newer stable version
if: steps.release.outputs.publish == 'true'
uses: JS-DevTools/npm-publish@0fd2f4369c5d6bcfcde6091a7c527d810b9b5c3f # v4.1.5
with:
strategy: upgrade
tag: latest