Skip to content

ci: keep the release and nightly secrets in environments - #41

Open
prabod wants to merge 1 commit into
mainfrom
chore/release-secrets-environments
Open

prabod wants to merge 1 commit into
mainfrom
chore/release-secrets-environments

Conversation

@prabod

@prabod prabod commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

Both secrets are repository-level today, so any workflow on any branch can read them. Also, workflow_dispatch of release.yml with publish_crates from a branch runs that branch's scripts/publish-crates.sh with the crates.io token.

This moves each secret's job into an environment:

  • crates job → crates-io: deployable from v* tags and main only, and a main-maintainers approval is needed before each publish.
  • record-llamacpp / record-mlx → nightly: deployable from main only. No reviewers, so the schedule still runs unattended. Dispatching from main still tests the newest rc branch, as before.

Do this before merging

Both environments are already set up: crates-io requires a main-maintainers approval and only runs from v* tags or main; nightly only runs from main. What's left is the secrets:

  1. Generate a new crates.io token, add it to the environment, and revoke the old token on crates.io (it has been readable by any branch):
    gh secret set CARGO_REGISTRY_TOKEN --env crates-io -R basecompute/superfluid
  2. Generate a new private key for the nightly App, add it, and delete the old key in the App's settings:
    gh secret set NIGHTLY_APP_PRIVATE_KEY --env nightly -R basecompute/superfluid < key.pem
  3. After merge, delete both repository-level secrets. Until then, any workflow can still read them:
    gh secret delete CARGO_REGISTRY_TOKEN -R basecompute/superfluid and gh secret delete NIGHTLY_APP_PRIVATE_KEY -R basecompute/superfluid

Follow-up worth doing: switch crates.io to trusted publishing (OIDC via rust-lang/crates-io-auth-action) so there's no long-lived token at all. Each crate has to be configured on crates.io first, and a crate's first publish still needs a token.

CARGO_REGISTRY_TOKEN moves to a crates-io environment (v* tags and main
only, a main-maintainer approves each publish) and NIGHTLY_APP_PRIVATE_KEY
to a nightly environment (main only). As repository secrets, any workflow
pushed to any branch could read them; workflow_dispatch of release.yml with
publish_crates from a branch also ran that branch's publish script with the
token.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant