Skip to content
Merged
Show file tree
Hide file tree
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
47 changes: 46 additions & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ on:

permissions:
id-token: write # Required for OIDC
contents: read
contents: write
issues: write

jobs:
publish_job:
Expand Down Expand Up @@ -44,9 +45,53 @@ jobs:
- if: ${{ inputs.major == true }}
name: Major Release - Bump version number, update changelog, push and tag
run: npm run release:major
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- if: ${{inputs.major == false && inputs.minor == true}}
name: Minor release - Bump version number, update changelog, push and tag
run: npm run release:minor
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- if: ${{inputs.major == false && inputs.minor == false}}
name: Patch release - Bump version number, update changelog, push and tag
run: npm run release:patch
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Verify packages are available on npm
run: |
for i in $(seq 1 10); do
missing=0
for pkg_json in npm/*/package.json; do
PKG=$(node -p "require('./${pkg_json}').name")
VERSION=$(node -p "require('./${pkg_json}').version")
if npm view "$PKG@$VERSION" version > /dev/null 2>&1; then
echo "$PKG@$VERSION is live on npm"
else
echo "$PKG@$VERSION not visible on npm yet"
missing=1
fi
done
if [ "$missing" -eq 0 ]; then
echo "All packages are live on npm"
exit 0
fi
echo "Retrying in 30s ($i/10)"
sleep 30
done
echo "One or more packages did not appear on npm"
exit 1

- name: File issue on publish failure
if: failure()
env:
GH_TOKEN: ${{ github.token }}
run: |
VERSION=$(node -p "require('./package.json').version")
gh issue create --repo "$GITHUB_REPOSITORY" \
--title "Publish workflow failed for v${VERSION}" \
--body "The publish workflow for \`v${VERSION}\` failed; check if the packages are fully available on npm.

Run: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}

cc @zplata"
3 changes: 2 additions & 1 deletion .release-it.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
},
"github": {
"release": true,
"releaseName": "${version}"
"releaseName": "${version}",
"releaseNotes": "npx auto-changelog --stdout --commit-limit false --unreleased --template https://raw.githubusercontent.com/release-it/release-it/master/templates/changelog-compact.hbs"
},
"hooks": {
"after:version:bump": [
Expand Down
Loading