-
Notifications
You must be signed in to change notification settings - Fork 112
50 lines (41 loc) · 1.28 KB
/
publish.yml
File metadata and controls
50 lines (41 loc) · 1.28 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
name: Publish package
on:
release:
types:
- published
workflow_dispatch:
inputs:
version:
description: "Package version to publish, without a leading v"
required: true
type: string
permissions:
contents: read
id-token: write
jobs:
publish:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
- name: Set up Node
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
with:
node-version: "22.14.0"
registry-url: "https://registry.npmjs.org"
- name: Install npm 11
run: npm install --global npm@11
- name: Install dependencies
run: npm ci
- name: Verify release version
env:
EXPECTED_VERSION: ${{ github.event.release.tag_name || inputs.version }}
run: |
package_version="$(node -p "require('./package.json').version")"
expected_version="${EXPECTED_VERSION#v}"
if [ "$package_version" != "$expected_version" ]; then
echo "Package version $package_version does not match release version $expected_version"
exit 1
fi
- name: Publish to npm
run: npm publish --access public