-
Notifications
You must be signed in to change notification settings - Fork 4
34 lines (31 loc) · 928 Bytes
/
Copy pathrelease.yml
File metadata and controls
34 lines (31 loc) · 928 Bytes
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
name: Release to npm
on:
release:
types: [published, edited]
workflow_dispatch:
permissions:
contents: read
id-token: write
jobs:
publish:
runs-on: ubuntu-latest
environment: npm
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 24
registry-url: https://registry.npmjs.org
cache: npm
- run: npm ci
- run: npm run verify
- name: Publish when this version is new
shell: bash
run: |
package_name="$(node -p "require('./package.json').name")"
package_version="$(node -p "require('./package.json').version")"
if npm view "${package_name}@${package_version}" version >/dev/null 2>&1; then
echo "${package_name}@${package_version} is already published; skipping."
else
npm publish --access public --provenance
fi