#11
feat: publish stable releases to crates.io
Summary
- publish stable
trylle-clireleases to crates.io after package builds complete - retrieve the crates.io token from Phase and use the protected
cratesenvironment - skip crates.io publishing for prerelease tags
Validation
cargo test --locked --test release_metadatacargo package --locked
Activity
4trylle-botreviewed4mo ago
3dff418 into master3mo ago
What changed
.github/workflows/publish-packages.yaml(+54/-0, single file) adds apublish-cratesjob that runscargo publish --lockedfortrylle-cliafterprepareandpublishing-readycomplete. It's gated on a newpublish_cratesjob output computed inprepare, pullsCRATES_CI_PUBLISHERfrom Phase (/publishingpath) viadocker run phasehq/cli, and runs under the protectedcratesGitHub Environment.Risk areas
Stable/prerelease gate is an indirect proxy.
publish_cratesis derived fromif [[ "$npm_version" == "$manifest_version" ]]rather than testing the tag/version string for a prerelease marker directly. The PR description frames this as "skip crates.io publishing for prerelease tags," but the equality check only captures that intent ifnpm_versionandmanifest_versionare guaranteed to diverge exactly when (and only when) the release is a prerelease. Since a crates.io publish can't be undone (only yanked, which doesn't remove the version), it's worth confirming this equality holds for all the tag shapes this pipeline can produce, not just the common case.eval "$phase_values"on docker-sourced output. The new "Publish source package" step capturesphasehq/cli secrets export ...stdout andevals it verbatim to populateCRATES_CI_PUBLISHER. If the Phase CLI's export format changes, or the secret value contains characters the shell reparses (quotes,$(...), backticks),evaleither fails loudly or executes unintended shell content. Low likelihood given Phase is an internal trusted store, but this is the one place in the diff where secrets-manager output is fed straight intoevalto gate a real, irreversible publish.PHASE_HOST/PHASE_ENVaren't in this job's ownenv:block. OnlyPHASE_APP_IDandPHASE_SERVICE_TOKENare set as step env vars, but thedocker run --env PHASE_HOST ...and--env "$PHASE_ENV"in the same step reference both. They must be coming from a workflow- or job-levelenv:defined elsewhere in the file (not visible in this diff). Worth a quick confirm thatpublish-cratesactually inherits them — an emptyPHASE_ENV/unsetPHASE_HOSTwould either fail the job or pointphasehq/cliat the wrong Phase environment.needs: [prepare, publishing-ready]doesn't list the build/package jobs directly. The PR description says this should publish "after package builds complete." That's presumably satisfied transitively ifpublishing-readyitself depends on the relevant build jobs, but that dependency isn't part of this diff, so it can't be verified here — worth confirmingpublishing-readyactually gates on the binary/package build before this can be trusted to run in the right order.Suggested follow-ups
npm_version == manifest_versioncheck explaining why that equality implies "stable, not prerelease" — the intent isn't obvious from the code alone.cargo publish --locked --dry-run(or similar) step before the real publish, given there's no way to walk back a bad one.cratesenvironment has required-reviewer protection configured in repo settings — that's the actual safety net ifpublish_cratesever evaluates incorrectly, and it isn't visible in this diff.Overall the guardrails here (protected environment, scoped token retrieval, explicit prerelease skip) show the right instincts for a one-way action like this. The points above are things I'd want confirmed before this runs against the real registry, not necessarily blockers.