-
Notifications
You must be signed in to change notification settings - Fork 9
41 lines (37 loc) · 1.2 KB
/
release.yml
File metadata and controls
41 lines (37 loc) · 1.2 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
name: Publish Cofhe Contracts Package to npmjs
on:
release:
types: [published]
permissions:
contents: read
id-token: write # Required for NPM OIDC trusted publishing
jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v4
with:
node-version: 22.x # Node 22 for npm 11.x (OIDC requires npm >= 11.5)
- name: Upgrade npm for OIDC support
run: npm install -g npm@latest
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: latest
run_install: false
- name: Install deps
run: cd contracts && pnpm install
- name: Read package version
id: package_version
run: echo "VERSION=$(jq -r .version < ./contracts/package.json)" >> $GITHUB_ENV
- name: Determine prerelease tag
id: prerelease_check
run: |
if [[ "${{ env.VERSION }}" =~ \-(alpha|beta)\.[0-9]+$ ]]; then
echo "PRERELEASE=--tag beta" >> $GITHUB_ENV
else
echo "PRERELEASE=" >> $GITHUB_ENV
fi
- name: Publish to npm
run: cd contracts && pnpm publish --no-git-checks ${{ env.PRERELEASE }}