Skip to content

ci: enable crates.io publishing; reclaim togl crate for the CLI#40

Merged
smorin merged 1 commit into
mainfrom
ci/crates-io-publish
May 31, 2026
Merged

ci: enable crates.io publishing; reclaim togl crate for the CLI#40
smorin merged 1 commit into
mainfrom
ci/crates-io-publish

Conversation

@smorin
Copy link
Copy Markdown
Owner

@smorin smorin commented May 31, 2026

Closes the crates.io gap (stuck at togl 0.2.3 — the pipeline only shipped GitHub binaries).

What

  • Reclaim togl: rename the CLI package togl-clitogl (directory unchanged; binaries stay toggle/togl). Continues the existing togl line so cargo install togl works (already in the README).
  • Publishable deps: add version to the togl-lib dep/dev-dep; mark togl-ffi publish = false (it's the libtogl C library, not a Rust dep).
  • publish-crates job in release.yml: on a release tag, sync the togl-lib dep version to the tag, then publish togl-lib then togl (cargo waits for the dep to land).
  • Update -p togl-cli refs in nix/togl.nix + the shell test script.

Why these were needed (not just a release.yml line)

  • crates.io's togl 0.2.3 predates the crate rename, so no workspace member was named togl anymore.
  • cargo publish refuses path-only depstogl-lib needed a version.

Verified

  • Full test suite (303) + nix build .#togl green after the rename.
  • cargo publish --dry-run clean for togl-lib; togl manifest validated (its full dry-run is gated only on togl-lib not yet being on crates.io — resolved by publish ordering).
  • actionlint clean; version-sync sed verified surgical (only togl-lib, not clap).

Note — does NOT affect nixpkgs PR #526149

That derivation builds the v0.5.0 tagged source, which still has togl-cli. The rename ships in v0.6.0; the nixpkgs bump will pick up -p togl then.

Maintainer step before it works

Add repo secret CARGO_REGISTRY_TOKEN (crates.io API token). Until then the publish job fails loudly but does not block the binary build. First publish fires on the next release tag.

The release pipeline only ships GitHub binaries, so crates.io has been stuck at
`togl` 0.2.3 (published before the toggle-*→togl-* crate rename). This wires up
crate publishing again.

- Rename the CLI package `togl-cli` → `togl` (directory unchanged; binaries
  stay `toggle`/`togl`). Continues the existing `togl` line so `cargo install
  togl` works, as the README already advertises.
- Add a `version` to the `togl-lib` dep/dev-dep (required for publishing).
- Mark `togl-ffi` `publish = false` (it's the libtogl C library, not a Rust
  dependency).
- Add a `publish-crates` job to release.yml: on a release tag it syncs the
  togl-lib dep version to the tag, then publishes `togl-lib` and `togl`
  (in order) with CARGO_REGISTRY_TOKEN.
- Update the `-p togl-cli` references in nix/togl.nix and the shell test script.

Verified: full test suite + `nix build .#togl` green after the rename;
`cargo publish --dry-run` clean for togl-lib (togl manifest validated; its full
dry-run is gated only on togl-lib not yet being on crates.io, resolved by the
publish ordering). actionlint clean.

Refs P11. First publish fires on the next release tag once CARGO_REGISTRY_TOKEN
is added.
Copilot AI review requested due to automatic review settings May 31, 2026 05:34
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Resumes crates.io publishing by reclaiming the togl crate name for the CLI package and adding an automated publish job to the release workflow. The CLI package (still under crates/togl-cli/) is renamed togl-clitogl, while binaries (toggle, togl) and the directory are unchanged.

Changes:

  • Rename CLI package to togl, add version to the togl-lib path dep (required by cargo publish), and mark togl-ffi as publish = false.
  • Add a publish-crates job to release.yml that syncs the togl-lib dep version to the release tag, then publishes togl-lib followed by togl.
  • Update -p togl-cli references in nix/togl.nix and tests/test_simple_python.sh; update Cargo.lock and PROJECTS.md.

Reviewed changes

Copilot reviewed 6 out of 7 changed files in this pull request and generated no comments.

Show a summary per file
File Description
crates/togl-cli/Cargo.toml Rename package to togl; add version = "0.5.0" to togl-lib dep/dev-dep.
crates/togl-ffi/Cargo.toml Set publish = false with explanatory comment.
Cargo.lock Reflect package rename togl-clitogl.
nix/togl.nix Switch cargoBuildFlags/cargoTestFlags to -p togl.
tests/test_simple_python.sh Update cargo run -p togl-cli-p togl.
.github/workflows/release.yml Add publish-crates job: token check, sed-based dep-version sync, publish togl-lib then togl.
PROJECTS.md Document Project P11 (crates.io publishing v0.6.0).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@smorin smorin merged commit 32740db into main May 31, 2026
21 checks passed
@smorin smorin deleted the ci/crates-io-publish branch May 31, 2026 13:45
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.

2 participants