Skip to content

Commit f5fa972

Browse files
improve: handle preventing previously published packages
1 parent aea8b95 commit f5fa972

File tree

2 files changed

+32
-5
lines changed

2 files changed

+32
-5
lines changed

.github/workflows/publish-to-npm.yml

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,26 @@ jobs:
4444
- name: Allow Publishing from publish-to-npm Branch
4545
run: pnpm config set publish-branch publish-to-npm
4646

47-
- name: Publish to npm Registry
47+
- name: Publish Framework Package
4848
run: |
49-
pnpm publish --filter ./packages/framework --no-git-checks
50-
pnpm publish --filter ./packages/runtime --no-git-checks
49+
current_version=$(jq -r '.version' packages/framework/package.json)
50+
latest_version=$(npm show @ensembleui/react-framework version || echo "none")
51+
52+
if [ "$current_version" != "$latest_version" ]; then
53+
echo "Publishing @ensembleui/react-framework version $current_version"
54+
pnpm publish --filter ./packages/framework --no-git-checks
55+
else
56+
echo "No version change detected for @ensembleui/react-framework. Skipping publish."
57+
fi
58+
59+
- name: Publish Runtime Package
60+
run: |
61+
current_version=$(jq -r '.version' packages/runtime/package.json)
62+
latest_version=$(npm show @ensembleui/react-runtime version || echo "none")
63+
64+
if [ "$current_version" != "$latest_version" ]; then
65+
echo "Publishing @ensembleui/react-runtime version $current_version"
66+
pnpm publish --filter ./packages/runtime --no-git-checks
67+
else
68+
echo "No version change detected for @ensembleui/react-runtime. Skipping publish."
69+
fi

.github/workflows/release.yml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,12 +80,20 @@ jobs:
8080
- name: Build packages
8181
run: pnpm run build --filter=./packages
8282

83+
# Delete existing .npmrc file if it exists
84+
- name: Delete existing .npmrc
85+
run: |
86+
if [ -f .npmrc ]; then
87+
echo "Deleting existing .npmrc file"
88+
rm .npmrc
89+
fi
90+
8391
- name: Create .npmrc for npm Registry
8492
run: |
8593
echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc
8694
echo "registry=https://registry.npmjs.org/" >> ~/.npmrc
8795
8896
- name: Publish to npm Registry
8997
run: |
90-
pnpm publish --filter ./packages/framework
91-
pnpm publish --filter ./packages/runtime
98+
pnpm publish --filter ./packages/framework --no-git-checks
99+
pnpm publish --filter ./packages/runtime --no-git-checks

0 commit comments

Comments
 (0)