Skip to content

Latest commit

 

History

History
91 lines (66 loc) · 7.61 KB

releasing-cli.md

File metadata and controls

91 lines (66 loc) · 7.61 KB

Releasing the chopin CLI

The chopin CLI (apps/connector) compiles into five standalone executables (Linux x64/arm64, macOS x64/arm64, and Windows x64). Pushing a cli-v<version> tag triggers .github/workflows/release-cli.yml, which builds the Windows session helper and checkout projection (apps/session-helper, bundled inside chopin-windows-x64.exe for chopin windows setup), compiles and scans all binaries, waits for human approval, and publishes them as GitHub release assets alongside the install scripts in apps/connector/install.

For how end users install and run the CLI, see Use your own machine with Chopin.

One-time setup

Publishing requires a protected GitHub Actions environment named chopin-cli-release. A human reviewer must approve that environment before any release goes public.

Because GitHub silently creates an unprotected environment if one does not exist, the workflow's preflight job checks the environment first and blocks the release unless all three rules are in place:

  • The chopin-cli-release environment exists.
  • It requires at least one reviewer under Required reviewers.
  • Its Deployment branches and tags policy is set to Selected branches and tags with only the tag pattern cli-v*.

The preflight job reads these rules with the workflow's built-in GITHUB_TOKEN (actions: read), so no extra secret is required.

A repository administrator sets up the environment once in Settings > Environments (https://github.com/githubnext/chopin/settings/environments) or through the GitHub CLI:

  1. Find the numeric ID of each reviewer (user or team):

    gh api users/<login> --jq .id
    gh api orgs/githubnext/teams/<team-slug> --jq .id
  2. Create the environment with up to six reviewers (use "type": "Team" for a team) and restrict deployments to selected policies:

    gh api --method PUT repos/githubnext/chopin/environments/chopin-cli-release --input - <<'EOF'
    {
      "reviewers": [{ "type": "User", "id": <reviewer-id> }],
      "deployment_branch_policy": { "protected_branches": false, "custom_branch_policies": true }
    }
    EOF
  3. Allow only cli-v* tags to deploy to the environment:

    gh api --method POST repos/githubnext/chopin/environments/chopin-cli-release/deployment-branch-policies \
      -f name='cli-v*' -f type=tag
  4. Verify that required_reviewers is present and cli-v* (type tag) is the only deployment policy:

    gh api repos/githubnext/chopin/environments/chopin-cli-release \
      --jq '{protection_rules: [.protection_rules[] | {type, reviewers: [.reviewers[]?.reviewer.login]}], deployment_branch_policy}'
    gh api repos/githubnext/chopin/environments/chopin-cli-release/deployment-branch-policies \
      --jq '[.branch_policies[] | {name, type}]'

Cut a release

Protocol compatibility and rollout order

If a connector change breaks compatibility with deployed servers, bump CONNECTOR_PROTOCOL in apps/connector/src/version.ts and update the accepted range CONNECTOR_PROTOCOLS in apps/server/src/experiments/routes.ts. A server rejects connectors outside its range and tells the user to run chopin update <version>.

Protocol What changed Rollout order
2 One-time machine pairing with a stored machine token (incompatible with protocol 1 clients) Release CLI (cli-v0.0.1+) before server deploy
4 Planner polling (wait_for_work) for --planner-command; older servers reject it Deploy server first, then release CLI
5 Connects the whole machine rather than one checkout (works across any pushable repository) Deploy server first, then release CLI
6 Claimed document ID sent on build renewals and status reports; older servers reject the field Deploy server first, then release CLI
7 Repository-scoped GitHub App installation tokens with bot/starter attribution (fails closed if missing) Configure App key + deploy server, then CLI
8 Mandatory agent isolation (chopin-connector-sandbox: nvx on Linux or windows on Windows; see Isolated agent sessions); older connectors are refused new work Release CLI (cli-v0.0.32+) before server

A running server recommends the CLI version listed in its own apps/connector/package.json (unless CONNECTOR_VERSION overrides it), and chopin update installs that recommended version. Publish a new CLI release before deploying a server whose package.json points to it, or set CONNECTOR_VERSION to an already published release in the meantime.

Release steps

  1. Update version in apps/connector/package.json (for example to 0.2.0) and merge the pull request. Pushing a tag that does not match package.json fails immediately.

  2. Optional dry run: trigger the release-cli workflow manually from GitHub Actions with that version. This builds all five binaries and runs the Microsoft Defender scan without publishing anything.

  3. Tag the merged commit and push the tag:

    git tag cli-v0.2.0 <commit>
    git push origin cli-v0.2.0
  4. The workflow builds chopin-linux-x64, chopin-linux-arm64, chopin-darwin-x64, chopin-darwin-arm64, and chopin-windows-x64.exe, generates checksums.txt, and scans the Windows executable with Microsoft Defender on current signatures (any detection fails the run). A separate read-only sbom job creates SPDX and CycloneDX software bills of materials, checks them for leaked secrets, and uploads them as the chopin-cli-sbom artifact.

  5. The preflight job verifies the chopin-cli-release environment rules. The publish job then pauses until a required reviewer approves it in the workflow run.

  6. After approval, publish verifies all binaries against checksums.txt, attaches GitHub build provenance attestations, and publishes the cli-v0.2.0 GitHub release (marked as latest) with the binaries, checksums.txt, install.sh, and install.ps1. Only this job has write access, and every GitHub Action it uses is from the actions organization pinned to a full commit SHA.

To verify a downloaded binary's provenance:

gh attestation verify chopin-linux-x64 -R githubnext/chopin

If a run fails before the GitHub release is created, fix the issue, delete the remote tag (git push origin :refs/tags/cli-v0.2.0), and push the tag again on the fixed commit (or bump to the next version). Never replace assets on an already published release, because its checksums and attestations are tied to the original files.

The binaries are not code-signed or notarized. Installing via curl or PowerShell irm does not add a browser download quarantine mark, so macOS Gatekeeper and Windows SmartScreen do not block them.