refactor(domain): encode comparison and lifecycle states exactly (#473) #184
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Release | |
| on: | |
| push: | |
| branches: [main] | |
| env: | |
| HUSKY: "0" | |
| concurrency: | |
| group: release-${{ github.ref }} | |
| cancel-in-progress: false | |
| jobs: | |
| release-please: | |
| name: Release Please | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| outputs: | |
| release_created: ${{ steps.release.outputs.release_created }} | |
| tag_name: ${{ steps.release.outputs.tag_name }} | |
| steps: | |
| - uses: googleapis/release-please-action@v4 | |
| id: release | |
| with: | |
| # A dedicated credential lets release-PR updates trigger CI. GitHub | |
| # requires manual approval for pull_request events from GITHUB_TOKEN. | |
| token: ${{ secrets.RELEASE_PLEASE_TOKEN || secrets.GITHUB_TOKEN }} | |
| - name: Check out release pull request | |
| if: steps.release.outputs.prs_created == 'true' | |
| uses: actions/checkout@v6 | |
| with: | |
| ref: ${{ fromJSON(steps.release.outputs.pr).headBranchName }} | |
| persist-credentials: false | |
| - name: Set up Node.js for generated documentation | |
| if: steps.release.outputs.prs_created == 'true' | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version-file: .nvmrc | |
| package-manager-cache: false | |
| - name: Install dependencies | |
| if: steps.release.outputs.prs_created == 'true' | |
| run: npm ci | |
| - name: Regenerate release documentation | |
| if: steps.release.outputs.prs_created == 'true' | |
| run: npm run docs:generate | |
| - name: Commit canonical release catalog | |
| if: steps.release.outputs.prs_created == 'true' | |
| shell: bash | |
| env: | |
| # Use the same identity for the follow-up commit so it also triggers CI. | |
| GH_TOKEN: ${{ secrets.RELEASE_PLEASE_TOKEN || secrets.GITHUB_TOKEN }} | |
| RELEASE_PR_JSON: ${{ steps.release.outputs.pr }} | |
| run: | | |
| release_pr_branch="$(node --input-type=module -e ' | |
| const value = JSON.parse(process.env.RELEASE_PR_JSON ?? ""); | |
| if ( | |
| typeof value !== "object" || | |
| value === null || | |
| typeof value.headBranchName !== "string" || | |
| value.headBranchName.length === 0 | |
| ) { | |
| process.exit(1); | |
| } | |
| process.stdout.write(value.headBranchName); | |
| ')" | |
| changed_paths="$(git diff --name-only)" | |
| if [[ -z "${changed_paths}" ]]; then | |
| echo "Release documentation is already canonical." | |
| exit 0 | |
| fi | |
| if [[ "${changed_paths}" != "docs/product-catalog.json" ]]; then | |
| echo "docs:generate changed unexpected tracked paths:" >&2 | |
| printf '%s\n' "${changed_paths}" >&2 | |
| exit 1 | |
| fi | |
| git diff --check | |
| git config user.name "github-actions[bot]" | |
| git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
| git add -- docs/product-catalog.json | |
| git commit -m "chore: normalize release product catalog" | |
| gh auth setup-git | |
| git push origin "HEAD:${release_pr_branch}" | |
| publish: | |
| name: Publish to npm | |
| needs: release-please | |
| if: needs.release-please.outputs.release_created == 'true' | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| id-token: write | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: actions/setup-node@v6 | |
| with: | |
| node-version-file: .nvmrc | |
| package-manager-cache: false | |
| registry-url: https://registry.npmjs.org | |
| - run: npm ci | |
| - name: Verify packaged release before publishing | |
| run: npm run verify:package | |
| - name: Publish | |
| run: npm publish --access public | |
| - name: Verify published CLI from npm | |
| shell: bash | |
| run: | | |
| version="$(node --input-type=module -e 'import packageJson from "./package.json" with { type: "json" }; process.stdout.write(packageJson.version)')" | |
| verification_root="$(mktemp -d)" | |
| trap 'rm -rf -- "${verification_root}"' EXIT | |
| cd "${verification_root}" | |
| for attempt in 1 2 3 4 5 6; do | |
| if npm view "rea-agents@${version}" version --json >/dev/null 2>&1 \ | |
| && npm exec --yes --package="rea-agents@${version}" -- rea --help \ | |
| && npm exec --yes --package="rea-agents@${version}" -- rea --llms \ | |
| && node "${GITHUB_WORKSPACE}/scripts/verify-published-package.mjs" "${version}"; then | |
| exit 0 | |
| fi | |
| if [ "${attempt}" -lt 6 ]; then | |
| echo "Published package verification attempt ${attempt} failed; retrying in 10 seconds" >&2 | |
| sleep 10 | |
| fi | |
| done | |
| echo "Published rea-agents@${version} failed registry and CLI verification" >&2 | |
| exit 1 | |
| publish-mcp: | |
| name: Publish to MCP Registry | |
| needs: [release-please, publish] | |
| if: needs.release-please.outputs.release_created == 'true' && needs.publish.result == 'success' | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| id-token: write | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| ref: ${{ needs.release-please.outputs.tag_name }} | |
| persist-credentials: false | |
| - name: Verify package and registry metadata versions | |
| run: npm run mcp-registry:check | |
| - name: Install MCP Registry publisher | |
| env: | |
| MCP_PUBLISHER_VERSION: v1.8.0 | |
| MCP_PUBLISHER_SHA256_LINUX_AMD64: 1370446bbe74d562608e8005a6ccce02d146a661fbd78674e11cc70b9618d6cf | |
| run: | | |
| archive="mcp-publisher_linux_amd64.tar.gz" | |
| curl -fsSLo "${archive}" \ | |
| "https://github.com/modelcontextprotocol/registry/releases/download/${MCP_PUBLISHER_VERSION}/${archive}" | |
| echo "${MCP_PUBLISHER_SHA256_LINUX_AMD64} ${archive}" | sha256sum --check --strict | |
| tar xzf "${archive}" mcp-publisher | |
| chmod +x mcp-publisher | |
| - name: Validate MCP Registry metadata | |
| run: ./mcp-publisher validate | |
| - name: Authenticate to MCP Registry | |
| run: ./mcp-publisher login github-oidc | |
| - name: Publish MCP Registry metadata | |
| run: ./mcp-publisher publish |