|
name: Release |
|
|
|
on: |
|
push: |
|
branches: [main] |
|
|
|
permissions: |
|
contents: write |
|
issues: write |
|
pull-requests: write |
|
|
|
jobs: |
|
release: |
|
name: semantic-release |
|
runs-on: ubuntu-latest |
|
steps: |
|
- uses: actions/checkout@v7 |
|
with: |
|
fetch-depth: 0 |
|
persist-credentials: false |
|
|
|
- uses: actions/setup-node@v7 |
|
with: |
|
node-version: "22" |
|
registry-url: https://registry.npmjs.org |
|
|
|
- uses: oven-sh/setup-bun@v2 |
|
with: |
|
bun-version: "1.3.14" |
|
|
|
- name: Install dependencies |
|
run: bun install --frozen-lockfile |
|
|
|
- name: Verify release candidate |
|
run: bun run verify:release-candidate |
|
|
|
- name: Release |
|
run: npx semantic-release |
|
env: |
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
|
NPM_TOKEN: ${{ secrets.NPMJS }} |
|
NODE_AUTH_TOKEN: ${{ secrets.NPMJS }} |
|
|
|
- name: Sync release manifests to main |
|
if: success() |
|
env: |
|
GH_TOKEN: ${{ secrets.RELEASE_SYNC_TOKEN || secrets.GITHUB_TOKEN }} |
|
run: | |
|
git checkout -- package.json manifest.json 2>/dev/null || true |
|
bun run scripts/sync-release-manifests.ts |
|
if [[ -z "$(git status --porcelain -- package.json manifest.json CHANGELOG.md)" ]]; then |
|
echo "manifests already match the latest tag" |
|
exit 0 |
|
fi |
|
VERSION=$(node -p "require('./package.json').version") |
|
BRANCH="chore/manifest-sync-v${VERSION}" |
|
git config user.name "github-actions[bot]" |
|
git config user.email "41898282+github-actions[bot]@users.noreply.github.com" |
|
git remote set-url origin "https://x-access-token:${GH_TOKEN}@github.com/${GITHUB_REPOSITORY}.git" |
|
git checkout -b "${BRANCH}" |
|
git add package.json manifest.json CHANGELOG.md |
|
git commit -m "chore(release): sync manifests to v${VERSION}" |
|
git push -u origin "${BRANCH}" |
|
gh pr create \ |
|
--title "chore(release): sync manifests to v${VERSION}" \ |
|
--body "Automated post-release manifest alignment. Sets package.json, manifest.json, and CHANGELOG.md to the released ${VERSION}." \ |
|
--base main --head "${BRANCH}" |
|
gh pr merge --auto --squash --delete-branch |