mirror of
https://github.com/kunkunsh/kunkun-ext-image-processing.git
synced 2025-04-04 10:16:45 +00:00
ci: enhance npm publish workflow to check for existing package version before publishing
This commit is contained in:
parent
4b3f695716
commit
ced7d030a0
16
.github/workflows/npm-publish.yml
vendored
16
.github/workflows/npm-publish.yml
vendored
@ -38,6 +38,20 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
node-version: 22
|
node-version: 22
|
||||||
registry-url: https://registry.npmjs.org/
|
registry-url: https://registry.npmjs.org/
|
||||||
- run: npm publish --provenance --access public
|
- run: |
|
||||||
|
PACKAGE_NAME=$(jq -r '.name' package.json)
|
||||||
|
PACKAGE_VERSION=$(jq -r '.version' package.json)
|
||||||
|
|
||||||
|
# Get the version from npm registry
|
||||||
|
REGISTRY_VERSION=$(npm show "$PACKAGE_NAME" version)
|
||||||
|
|
||||||
|
# Compare versions
|
||||||
|
if [ "$PACKAGE_VERSION" == "$REGISTRY_VERSION" ]; then
|
||||||
|
echo "Version $PACKAGE_VERSION already exists in the npm registry."
|
||||||
|
exit 0
|
||||||
|
else
|
||||||
|
echo "Version $PACKAGE_VERSION does not exist in the npm registry. Proceeding..."
|
||||||
|
npm publish --provenance --access public
|
||||||
|
fi
|
||||||
env:
|
env:
|
||||||
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
|
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user