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
18 changes: 18 additions & 0 deletions .github/workflows/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,24 @@ compose freely.
Dispatch `release-prepare` with a bump and a channel, review the release PR it opens, merge it.
`release-publish` then publishes the merged package.json version.

Publishing listens for pushes to `refactor` (switch to `main` when the refactor lands), not PR
events. It looks up the pushed commit's associated PRs and proceeds only when that exact commit
is the merge of a `release/v*` PR opened by `agentcore-devx-automation[bot]` (account ID
`282717993`) from this repository into the target branch. Manually opened release PRs,
ordinary merges, fork PRs, and pushes without a matching release PR skip verification and
publishing. Every job uses the pushed SHA, so later commits cannot change what is released.

The prepare job uses `aws-release-4-core`. The check-release and publish jobs stay on
`ubuntu-latest` until `release-publish.yml` is allowlisted for the dedicated runner group.
The allowlist is scoped to workflow paths and branches; renaming a workflow or changing its
branch requires a runner-group administrator to update it. Keep PR-triggered workflows
and the verification matrix off this release-only pool.

The npm package includes `dist` except `dist/bin`, plus standard package metadata. This keeps
additional bundle chunks and runtime assets included as the build evolves. Native binaries in
`dist/bin` are separate GitHub release assets, never npm package contents, even when packing a
workspace that has already compiled them.

If publish fails after the merge, rerun the failed `release-publish` jobs. Both the npm publish
and the GitHub release steps skip work that already succeeded. Do not re-dispatch
`release-prepare`, package.json already holds the new version and it would bump again.
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-prepare.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ on:

jobs:
prepare:
runs-on: ubuntu-latest
runs-on: aws-release-4-core
permissions:
contents: read
steps:
Expand Down
38 changes: 33 additions & 5 deletions .github/workflows/release-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,47 @@
# release-prepare.yml merges. The version is whatever the merged package.json says.
name: release-publish
on:
pull_request:
types: [closed]
push:
# TODO: switch to main once the refactor lands there.
branches: [refactor]

jobs:
check-release:
if: "!github.event.deleted"
runs-on: ubuntu-latest
permissions:
pull-requests: read
outputs:
is_release: ${{ steps.check.outputs.is_release }}
steps:
# Push runs the trusted base-branch workflow, but does not carry the merged PR's metadata.
- name: Check for a merged release PR
id: check
env:
GH_TOKEN: ${{ github.token }}
run: |
set -euo pipefail
IS_RELEASE=$(gh api --paginate --slurp "repos/$GITHUB_REPOSITORY/commits/$GITHUB_SHA/pulls" \
| jq -r --arg repository "$GITHUB_REPOSITORY" --arg ref "$GITHUB_REF_NAME" --arg sha "$GITHUB_SHA" '
any(.[][];
# Stable account ID for agentcore-devx-automation[bot].
.user.id == 282717993 and
.merged_at != null and
.merge_commit_sha == $sha and
.head.repo.full_name == $repository and
.base.ref == $ref and
(.head.ref | startswith("release/v"))
)')
echo "is_release=$IS_RELEASE" >> "$GITHUB_OUTPUT"

verify:
if: github.event.pull_request.merged && startsWith(github.head_ref, 'release/v')
needs: check-release
if: needs.check-release.outputs.is_release == 'true'
uses: ./.github/workflows/verify.yml
permissions:
contents: read
with:
ref: ${{ github.event.pull_request.merge_commit_sha }}
ref: ${{ github.sha }}

publish:
needs: verify
Expand All @@ -24,7 +52,7 @@ jobs:
contents: write
id-token: write
env:
REF: ${{ github.event.pull_request.merge_commit_sha }}
REF: ${{ github.sha }}
steps:
- uses: actions/checkout@v7
with:
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
"node": ">=20.12.0"
},
"files": [
"dist"
"dist",
"!dist/bin"
],
"scripts": {
"build": "bun scripts/build.ts bundle",
Expand Down
Loading