Skip to content

Commit da20230

Browse files
authored
Merge pull request #72 from jamals86/feature/api-schema
Update release.yml
2 parents 0b97604 + e8e4807 commit da20230

1 file changed

Lines changed: 23 additions & 1 deletion

File tree

.github/workflows/release.yml

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,12 @@ on:
4545
required: false
4646
default: true
4747

48+
force_npm_publish:
49+
description: "Force republish (unpublish existing version first)"
50+
type: boolean
51+
required: false
52+
default: false
53+
4854
permissions:
4955
contents: write
5056

@@ -1358,12 +1364,28 @@ jobs:
13581364
run: |
13591365
set -euo pipefail
13601366
VERSION="${{ steps.vars.outputs.version }}"
1367+
FORCE_PUBLISH="${{ github.event.inputs.force_npm_publish }}"
13611368
13621369
echo "🚀 Publishing kalam-link@$VERSION to npm..."
13631370
13641371
# Check if this version already exists
13651372
if npm view "kalam-link@$VERSION" version 2>/dev/null; then
1366-
echo "⚠️ Version $VERSION already exists on npm, skipping publish"
1373+
if [[ "$FORCE_PUBLISH" == "true" ]]; then
1374+
echo "⚠️ Version $VERSION exists. Force publish enabled - attempting to unpublish..."
1375+
if npm unpublish "kalam-link@$VERSION" --force 2>/dev/null; then
1376+
echo "✅ Successfully unpublished kalam-link@$VERSION"
1377+
npm publish --access public
1378+
echo "✅ Successfully republished kalam-link@$VERSION to npm!"
1379+
else
1380+
echo "❌ Failed to unpublish (version may be >72 hours old)"
1381+
echo "💡 Tip: npm doesn't allow unpublishing after 72 hours."
1382+
echo " Use a different version number (e.g., ${VERSION}.1, ${VERSION}.2)"
1383+
exit 1
1384+
fi
1385+
else
1386+
echo "⚠️ Version $VERSION already exists on npm, skipping publish"
1387+
echo "💡 To force republish, enable 'force_npm_publish' workflow input"
1388+
fi
13671389
else
13681390
npm publish --access public
13691391
echo "✅ Successfully published kalam-link@$VERSION to npm!"

0 commit comments

Comments
 (0)