-
Notifications
You must be signed in to change notification settings - Fork 0
70 lines (63 loc) · 2.17 KB
/
release-web-cli.yml
File metadata and controls
70 lines (63 loc) · 2.17 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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
name: npm release
on:
push:
tags:
- "v*"
jobs:
release:
runs-on: ubuntu-latest
concurrency:
group: web-cli-release-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: "write"
id-token: "write"
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Set up pnpm
uses: pnpm/action-setup@v3
with:
version: 10 # Use pnpm version 10
- name: Set up Node.js
uses: actions/setup-node@v4
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
with:
node-version: "22.x" # Use Node.js 22.x
cache: "pnpm"
registry-url: "https://registry.npmjs.org/"
# The version check is necessary because the web-cli is published as a separate package from the main CLI
# and we can't guarantee a version bump every time the CLI releases.
- name: Check if version already exists on npm
id: version-check
run: |
cd packages/react-web-cli
VERSION=$(node -p "require('./package.json').version")
echo "Package version: $VERSION"
if pnpm view @ably/react-web-cli@$VERSION > /dev/null 2>&1; then
echo "Version $VERSION already exists on npm"
echo "should-publish=false" >> $GITHUB_OUTPUT
else
echo "Version $VERSION does not exist on npm, proceeding with publish"
echo "should-publish=true" >> $GITHUB_OUTPUT
fi
- name: Install dependencies
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
cd packages/react-web-cli
pnpm install --frozen-lockfile
- name: Publish
if: steps.version-check.outputs.should-publish == 'true'
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
cd packages/react-web-cli
pnpm run build
pnpm publish --provenance --access public --no-git-checks
- name: Skip publish - version already exists
if: steps.version-check.outputs.should-publish == 'false'
run: |
echo "Skipping publish because the version already exists on npm"