-
Notifications
You must be signed in to change notification settings - Fork 3
51 lines (39 loc) · 1.15 KB
/
node-publish.yml
File metadata and controls
51 lines (39 loc) · 1.15 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 to npmjs
on:
release:
types: [published]
jobs:
publish:
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
steps:
- name: ⬇️ Check out code
uses: actions/checkout@v4
- name: 🟢 Enable Corepack
run: corepack enable
- name: 🟢 Set up Node 20
uses: actions/setup-node@v4
with:
node-version: 20.x
cache: yarn
registry-url: 'https://registry.npmjs.org'
- name: Build and Publish
run: |
yarn install --frozen-lockfile
yarn build
npm whoami
VERSION=$(node -p "require('./packages/imagekit-editor/package.json').version" )
# Only publish stable versions to the latest tag
if [[ "$VERSION" =~ ^[^-]+$ ]]; then
NPM_TAG="latest"
else
NPM_TAG="beta"
fi
echo "Publishing $VERSION with $NPM_TAG tag."
cd packages/imagekit-editor
npm publish --tag "$NPM_TAG" --provenance --access public
env:
NODE_AUTH_TOKEN: ${{secrets.npm_token}}
CI: true