From b6ff5c36d622ed2f28090a507369c3c172140fcb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Loipf=C3=BChrer?= Date: Sun, 20 Sep 2026 18:35:40 +0200 Subject: [PATCH 1/2] ci: publish cli package to crates.io on tagged releases Similar setup to our pypi publishing setup using trusted publishing. --- .bumpversion.toml | 5 +++++ .github/workflows/release.yaml | 26 +++++++++++++++++++++++++- Cargo.toml | 2 +- docs/develop/releasing.md | 7 +++++-- packages/debmagic-common/Cargo.toml | 2 ++ packages/debmagic/CHANGELOG.md | 3 +++ packages/debmagic/Cargo.toml | 3 +++ 7 files changed, 44 insertions(+), 4 deletions(-) diff --git a/.bumpversion.toml b/.bumpversion.toml index dc0b7a6c..5052e4e3 100644 --- a/.bumpversion.toml +++ b/.bumpversion.toml @@ -60,6 +60,11 @@ filename = "packages/debmagic-common/Cargo.toml" search = 'version = "{current_version}"' replace = 'version = "{new_version}"' +[[tool.bumpversion.files]] +filename = "Cargo.toml" +search = 'debmagic-common = { path = "packages/debmagic-common", version = "{current_version}" }' +replace = 'debmagic-common = { path = "packages/debmagic-common", version = "{new_version}" }' + # Promote notes under [Unreleased] into a dated release section; keep [Unreleased] for the next cycle. [[tool.bumpversion.files]] filename = "packages/debmagic/CHANGELOG.md" diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 7d804343..746441ca 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -11,7 +11,7 @@ jobs: uses: ./.github/workflows/ci.yaml secrets: inherit - publish: + publish-pypi: needs: ci runs-on: ubuntu-latest environment: @@ -43,3 +43,27 @@ jobs: --compatibility pypi - name: Publish to PyPI run: uv publish --trusted-publishing always + + publish-crates-io: + needs: ci + runs-on: ubuntu-latest + environment: + name: crates-io-publish + permissions: + id-token: write + contents: read + steps: + - name: Checkout + uses: actions/checkout@v5 + - name: Install Rust toolchain + run: rustup show + - uses: Swatinem/rust-cache@v2 + - name: Authenticate to crates.io + uses: rust-lang/crates-io-auth-action@v1 + id: auth + - name: Publish crates + env: + CARGO_REGISTRY_TOKEN: ${{ steps.auth.outputs.token }} + run: | + cargo publish -p debmagic-common --locked + cargo publish -p debmagic --locked diff --git a/Cargo.toml b/Cargo.toml index e7533308..7d2110f1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,7 +8,7 @@ rust-version = "1.89" [workspace.dependencies] # internal -debmagic-common = { path = "packages/debmagic-common" } +debmagic-common = { path = "packages/debmagic-common", version = "0.0.1-alpha.7" } # third party clap = { version = ">=4.5.23", features = ["derive"] } diff --git a/docs/develop/releasing.md b/docs/develop/releasing.md index b3b091d6..6f140553 100644 --- a/docs/develop/releasing.md +++ b/docs/develop/releasing.md @@ -25,8 +25,11 @@ below `[Unreleased]`, so those notes become the release notes for the new versio Then commit, tag, and push. A `v*` tag (e.g. `v0.0.1-alpha.2`) triggers the [release workflow](../../.github/workflows/release.yaml), which runs -[CI](../../.github/workflows/ci.yaml) first and, on success, builds `debmagic` -(cli) and publishes it to PyPI via Trusted Publishing. +[CI](../../.github/workflows/ci.yaml) first and, on success, publishes in +parallel: + +- `debmagic` (cli) to PyPI via Trusted Publishing +- `debmagic-common` then `debmagic` to crates.io via Trusted Publishing ```shell git push diff --git a/packages/debmagic-common/Cargo.toml b/packages/debmagic-common/Cargo.toml index 8eced4fa..0c914691 100644 --- a/packages/debmagic-common/Cargo.toml +++ b/packages/debmagic-common/Cargo.toml @@ -1,6 +1,8 @@ [package] name = "debmagic-common" version = "0.0.1-alpha.7" +description = "Shared helpers for debmagic (Debian versions, distro detection)" +license = "GPL-2.0-or-later" documentation = "https://debmagic.readthedocs.org" homepage = "https://github.com/SFTtech/debmagic" repository = "https://github.com/SFTtech/debmagic.git" diff --git a/packages/debmagic/CHANGELOG.md b/packages/debmagic/CHANGELOG.md index 51771e74..673a4df2 100644 --- a/packages/debmagic/CHANGELOG.md +++ b/packages/debmagic/CHANGELOG.md @@ -7,6 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +- publish the Rust crates to crates.io on tagged releases +- provide a native implementation of the package signing workflow + ## [0.0.1-alpha.7] - 2026-08-25 - support non-debian and non-ubuntu distros using dpkg diff --git a/packages/debmagic/Cargo.toml b/packages/debmagic/Cargo.toml index 8ee261cc..4c8733b8 100644 --- a/packages/debmagic/Cargo.toml +++ b/packages/debmagic/Cargo.toml @@ -1,6 +1,9 @@ [package] name = "debmagic" version = "0.0.1-alpha.7" +description = "modern tooling for building and packaging Debian/Ubuntu packages in isolated environments" +license = "GPL-2.0-or-later" +readme = "README.md" documentation = "https://debmagic.readthedocs.org" homepage = "https://github.com/SFTtech/debmagic" repository = "https://github.com/SFTtech/debmagic.git" From c905e3ab7653ca179b6e1ca2ee59107d053ecab5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Loipf=C3=BChrer?= Date: Sun, 20 Sep 2026 18:39:15 +0200 Subject: [PATCH 2/2] docs: also list cargo as a way to install the cli tool --- docs/usage/getting-started.md | 8 +++++++- packages/debmagic/README.md | 6 +++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/docs/usage/getting-started.md b/docs/usage/getting-started.md index 9a7d9e7a..30415176 100644 --- a/docs/usage/getting-started.md +++ b/docs/usage/getting-started.md @@ -2,13 +2,19 @@ ## Installation +### Cargo + +```shell +cargo install debmagic +``` + ### Pip ```shell pip install debmagic ``` -or directly use uv +or run it directly with uv: ```shell uvx debmagic diff --git a/packages/debmagic/README.md b/packages/debmagic/README.md index 154e4c10..0ef9552c 100644 --- a/packages/debmagic/README.md +++ b/packages/debmagic/README.md @@ -9,11 +9,15 @@ Modern, robust & easy tooling for building and packaging [Debian](https://debian ## Installation +```shell +cargo install debmagic +``` + ```shell pip install debmagic ``` -or run it directly: +or run it directly with uv: ```shell uvx debmagic