Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 14 additions & 5 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
publish:
name: "Publish to npm with Provenance"
runs-on: ubuntu-latest
timeout-minutes: 10
timeout-minutes: 15

# Only run on main branch to prevent accidental publishes from forks
if: github.repository == 'mobilemind/text2datauri' && (github.event_name == 'release' || github.event_name == 'workflow_dispatch')
Expand Down Expand Up @@ -161,11 +161,20 @@ jobs:
if: github.event_name == 'release' || (github.event_name == 'workflow_dispatch' && inputs.dry_run == 'false')
run: |
PACKAGE_VERSION="$(node -p "require('./package.json').version")"
echo 'Waiting 30 seconds for npm registry to update...'
sleep 30

echo "Verifying publication of text2datauri@$PACKAGE_VERSION"
npm view "text2datauri@$PACKAGE_VERSION" version

# npm publish returns 202 (processing); registry propagation can take
# several minutes, so retry rather than sleep a fixed time.
i=0
until npm view "text2datauri@$PACKAGE_VERSION" version >/dev/null 2>&1; do
i=$((i + 1))
if [ "$i" -ge 30 ]; then
echo "❌ text2datauri@$PACKAGE_VERSION not visible on npm after 30 tries"
exit 1
fi
echo "Not visible on npm yet (try $i/30); retrying in 15 seconds..."
sleep 15
done

echo '✓ Package successfully published and verified'
echo "📦 View at: https://www.npmjs.com/package/text2datauri/v/$PACKAGE_VERSION"
Expand Down
Loading