-
Notifications
You must be signed in to change notification settings - Fork 1
51 lines (42 loc) · 1.31 KB
/
Copy pathpublish.yml
File metadata and controls
51 lines (42 loc) · 1.31 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
name: Publish Package
on:
release:
types:
- published
permissions:
id-token: write # Required for OIDC
contents: read
jobs:
publish:
if: ${{ github.event.release.prerelease == false }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version: "20"
registry-url: "https://registry.npmjs.org"
# Ensure npm 11.5.1 or later is installed for proper OIDC support
- name: Update npm
run: npm install -g npm@latest
- run: npm ci
- name: Derive release version
id: release_version
env:
RELEASE_TAG: ${{ github.event.release.tag_name }}
run: |
VERSION="${RELEASE_TAG#refs/tags/}"
VERSION="${VERSION#v}"
if [[ -z "$VERSION" ]]; then
echo "Unable to determine version from release tag '${RELEASE_TAG}'" >&2
exit 1
fi
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
- name: Sync package metadata
run: |
npm version "${{ steps.release_version.outputs.version }}" --no-git-tag-version
- run: npm run build:all --if-present
- run: npm run verify:browser-build --if-present
- run: npm publish --access public