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
18 changes: 18 additions & 0 deletions .github/workflows/publish-to-npm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ name: Publish to npm
on:
push:
branches: [ master ]
# A merge that only changes workflows does not change the package, so it is not released
paths-ignore:
- '.github/**'

# Never run two publishes at once; a second merge waits for the first to finish
concurrency:
Expand Down Expand Up @@ -51,6 +54,21 @@ jobs:
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN2 }}
# npm may take several minutes to make a new version available; downstream repositories install @latest
# as soon as they are dispatched, so wait until the new version can be fetched before dispatching
- name: Wait for the new version on npm
run: |
version=$(node -p "require('./package.json').version")
for i in $(seq 1 60); do
if curl -sf -o /dev/null "https://registry.npmjs.org/@openactive%2fdata-model-validator/$version?nocache=$(date +%s)"; then
echo "$version is available on npm"
exit 0
fi
echo "Attempt $i: $version not yet available, waiting"
sleep 30
done
echo "$version was not available on npm within 30 minutes"
exit 1

dispatch:
needs: publish
Expand Down
Loading