Files
David Ibia aa2c8f2d6d Add CI, release, and Pages workflows with Dependabot
- ci.yml: typecheck, tests, and pack check on Ubuntu (Node 22, 24, 26), macOS and Windows (Node 24)
- release.yml: tag vX.Y.Z reruns CI, checks tag, package.json and CHANGELOG agree, publishes with npm trusted publishing, and creates the GitHub Release
- pages.yml: deploys site/ to GitHub Pages
- Jobs run on GitHub only; the Gitea origin's runner skips them
- Dependabot proposes grouped npm and Actions updates weekly
2026-10-20 15:10:09 +01:00

80 lines
2.4 KiB
YAML

name: Release
# Push a vX.Y.Z tag after bumping package.json and dating the CHANGELOG section.
# Publishing uses npm trusted publishing (OIDC): no npm token is stored in this repository.
on:
push:
tags: ["v*.*.*"]
permissions:
contents: read
concurrency:
group: release-${{ github.ref }}
cancel-in-progress: false
jobs:
verify:
name: Verify
# GitHub only: npm trusted publishing needs GitHub's OIDC token; later jobs skip with this one.
if: github.server_url == 'https://github.com'
uses: ./.github/workflows/ci.yml
publish:
name: Publish to npm
needs: verify
runs-on: ubuntu-latest
environment: npm
permissions:
contents: read
id-token: write
env:
HUSKY: "0"
steps:
- uses: actions/checkout@v7
- uses: actions/setup-node@v7
with:
node-version: 24
registry-url: https://registry.npmjs.org
package-manager-cache: false
- name: Use npm 12 (trusted publishing needs 11.5.1 or later)
run: npm install -g npm@12
- name: Check tag, package.json, and CHANGELOG agree
run: |
version="${GITHUB_REF_NAME#v}"
package_version="$(node -p "require('./package.json').version")"
if [ "$version" != "$package_version" ]; then
echo "::error::Tag $GITHUB_REF_NAME does not match package.json version $package_version"
exit 1
fi
node .github/scripts/changelog-section.mjs "$version" > /dev/null
- run: npm ci
- run: npm run build
- name: Publish
run: |
version="${GITHUB_REF_NAME#v}"
if [[ "$version" == *-* ]]; then
npm publish --access public --tag next
else
npm publish --access public
fi
github-release:
name: GitHub Release
needs: publish
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v7
- name: Create release from CHANGELOG
env:
GH_TOKEN: ${{ github.token }}
run: |
version="${GITHUB_REF_NAME#v}"
node .github/scripts/changelog-section.mjs "$version" > release-notes.md
prerelease=""
if [[ "$version" == *-* ]]; then prerelease="--prerelease"; fi
gh release create "$GITHUB_REF_NAME" --verify-tag --title "$GITHUB_REF_NAME" --notes-file release-notes.md $prerelease