Skip to content

Commit 54fceca

Browse files
committed
Inline npm publish behavior into create-cli-release.yml and remove the separate publish-npm.yml reusable workflow to simplify release pipeline orchestration and input wiring.
1 parent 0e81dd8 commit 54fceca

2 files changed

Lines changed: 33 additions & 58 deletions

File tree

.github/workflows/create-cli-release.yml

Lines changed: 33 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,6 @@ on:
99
required: true
1010
default: false
1111

12-
permissions:
13-
contents: read
14-
id-token: write
15-
1612
jobs:
1713
get-version-channel:
1814
runs-on: ubuntu-latest
@@ -32,11 +28,39 @@ jobs:
3228
needs: [get-version-channel]
3329
# if NOT isStableCandidate confirm dist tag is in package.json version
3430
if: fromJSON(needs.get-version-channel.outputs.isStableRelease) || (!fromJSON(inputs.isStableCandidate) && !!needs.get-version-channel.outputs.channel)
35-
uses: ./.github/workflows/publish-npm.yml
36-
with:
37-
isStableRelease: ${{ fromJSON(needs.get-version-channel.outputs.isStableRelease) }}
38-
channel: ${{ needs.get-version-channel.outputs.channel }}
39-
secrets: inherit
31+
# pub-hk-ubuntu-22.04- due to IP allow list issues with public repos: https://salesforce.quip.com/bu6UA0KImOxJ
32+
runs-on: pub-hk-ubuntu-22.04-small
33+
permissions:
34+
contents: read
35+
id-token: write
36+
steps:
37+
- uses: actions/checkout@v6
38+
- name: Use Node.js 22.x
39+
uses: actions/setup-node@v6
40+
with:
41+
node-version: 22.x
42+
cache: npm
43+
registry-url: 'https://registry.npmjs.org'
44+
- run: npm ci
45+
- name: Update npm for trusted publishing
46+
run: npm install -g npm@latest
47+
- name: Publish to NPM
48+
run: |
49+
PACKAGE_VERSION=$(node -e "console.log(require('./package.json').version)")
50+
PACKAGE_NAME=$(node -e "console.log(require('./package.json').name)")
51+
52+
if npm view $PACKAGE_NAME@$PACKAGE_VERSION version &>/dev/null; then
53+
echo "Version $PACKAGE_VERSION already published to npm, skipping"
54+
exit 0
55+
fi
56+
57+
if ${{ fromJSON(needs.get-version-channel.outputs.isStableRelease) }}
58+
then
59+
npm publish
60+
else
61+
npm publish --tag ${{ needs.get-version-channel.outputs.channel || 'beta' }}
62+
fi
63+
shell: bash
4064

4165
pack-upload:
4266
needs: [publish-npm]

.github/workflows/publish-npm.yml

Lines changed: 0 additions & 49 deletions
This file was deleted.

0 commit comments

Comments
 (0)