Repository navigation
69 lines (62 loc) · 2.27 KB
/
Copy pathrelease-web-cli.yml
File metadata and controls
69 lines (62 loc) · 2.27 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
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@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
submodules: true
- name: Set up pnpm
uses: pnpm/action-setup@0e279bb959325dab635dd2c09392533439d90093 # v6
with:
version: 10 # Use pnpm version 10
- name: Set up Node.js
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
with:
node-version: "22.x" # Use Node.js 22.x
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"