From 768e7a76c2c46369a52f89502d6ee3cd137a6401 Mon Sep 17 00:00:00 2001 From: minsoo-web Date: Mon, 6 Apr 2026 01:08:37 +0900 Subject: [PATCH 1/4] ci: add crates.io publish reusable workflow --- .github/workflows/publish-crate.yml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 .github/workflows/publish-crate.yml diff --git a/.github/workflows/publish-crate.yml b/.github/workflows/publish-crate.yml new file mode 100644 index 0000000..b6bd6bf --- /dev/null +++ b/.github/workflows/publish-crate.yml @@ -0,0 +1,18 @@ +name: Publish to crates.io + +on: + workflow_call: + inputs: + plan: + required: true + type: string + +jobs: + publish-crate: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + persist-credentials: false + - uses: dtolnay/rust-toolchain@stable + - run: cargo publish --token ${{ secrets.CARGO_REGISTRY_TOKEN }} From ab109e9adfbfcb74105d91d28a18ad0dae15f382 Mon Sep 17 00:00:00 2001 From: minsoo-web Date: Mon, 6 Apr 2026 01:13:34 +0900 Subject: [PATCH 2/4] ci: integrate crates.io publish into release pipeline Co-Authored-By: Claude Sonnet 4.6 --- .github/workflows/release.yml | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 151d108..3c68d0a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -278,6 +278,16 @@ jobs: gh release create "${{ needs.plan.outputs.tag }}" --target "$RELEASE_COMMIT" $PRERELEASE_FLAG --title "$ANNOUNCEMENT_TITLE" --notes-file "$RUNNER_TEMP/notes.txt" artifacts/* + publish-crate: + needs: + - plan + - host + if: ${{ !fromJson(needs.plan.outputs.val).announcement_is_prerelease || fromJson(needs.plan.outputs.val).publish_prereleases }} + uses: ./.github/workflows/publish-crate.yml + with: + plan: ${{ needs.plan.outputs.val }} + secrets: inherit + publish-homebrew-formula: needs: - plan @@ -328,11 +338,12 @@ jobs: needs: - plan - host + - publish-crate - publish-homebrew-formula # use "always() && ..." to allow us to wait for all publish jobs while # still allowing individual publish jobs to skip themselves (for prereleases). # "host" however must run to completion, no skipping allowed! - if: ${{ always() && needs.host.result == 'success' && (needs.publish-homebrew-formula.result == 'skipped' || needs.publish-homebrew-formula.result == 'success') }} + if: ${{ always() && needs.host.result == 'success' && (needs.publish-crate.result == 'skipped' || needs.publish-crate.result == 'success') && (needs.publish-homebrew-formula.result == 'skipped' || needs.publish-homebrew-formula.result == 'success') }} runs-on: "ubuntu-22.04" env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} From dbf1facc254a61ccc1b340a2da9a395de3f2155f Mon Sep 17 00:00:00 2001 From: minsoo-web Date: Mon, 6 Apr 2026 01:24:44 +0900 Subject: [PATCH 3/4] ci: add crates.io to cargo-dist publish-jobs Co-Authored-By: Claude Opus 4.6 (1M context) --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index fd2f7e5..5f63158 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -34,5 +34,5 @@ cargo-dist-version = "0.31.0" ci = ["github"] installers = ["homebrew"] tap = "hamsurang/homebrew-deepwiki-cli" -publish-jobs = ["homebrew"] +publish-jobs = ["homebrew", "./publish-crate"] targets = ["aarch64-apple-darwin", "x86_64-apple-darwin", "x86_64-unknown-linux-gnu"] From 54fa4036148dbeeb4c06a281153a6557c5ee10ee Mon Sep 17 00:00:00 2001 From: minsoo-web Date: Mon, 6 Apr 2026 01:35:03 +0900 Subject: [PATCH 4/4] ci: regenerate release.yml via dist init cargo-dist expects custom publish jobs to use `custom-` prefix and be placed after built-in publish jobs with escalated permissions. Co-Authored-By: Claude Opus 4.6 (1M context) --- .github/workflows/release.yml | 28 ++++++++++++++++------------ Cargo.toml | 9 ++++++++- 2 files changed, 24 insertions(+), 13 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 3c68d0a..405dfb3 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -278,16 +278,6 @@ jobs: gh release create "${{ needs.plan.outputs.tag }}" --target "$RELEASE_COMMIT" $PRERELEASE_FLAG --title "$ANNOUNCEMENT_TITLE" --notes-file "$RUNNER_TEMP/notes.txt" artifacts/* - publish-crate: - needs: - - plan - - host - if: ${{ !fromJson(needs.plan.outputs.val).announcement_is_prerelease || fromJson(needs.plan.outputs.val).publish_prereleases }} - uses: ./.github/workflows/publish-crate.yml - with: - plan: ${{ needs.plan.outputs.val }} - secrets: inherit - publish-homebrew-formula: needs: - plan @@ -334,16 +324,30 @@ jobs: done git push + custom-publish-crate: + needs: + - plan + - host + if: ${{ !fromJson(needs.plan.outputs.val).announcement_is_prerelease || fromJson(needs.plan.outputs.val).publish_prereleases }} + uses: ./.github/workflows/publish-crate.yml + with: + plan: ${{ needs.plan.outputs.val }} + secrets: inherit + # publish jobs get escalated permissions + permissions: + "id-token": "write" + "packages": "write" + announce: needs: - plan - host - - publish-crate - publish-homebrew-formula + - custom-publish-crate # use "always() && ..." to allow us to wait for all publish jobs while # still allowing individual publish jobs to skip themselves (for prereleases). # "host" however must run to completion, no skipping allowed! - if: ${{ always() && needs.host.result == 'success' && (needs.publish-crate.result == 'skipped' || needs.publish-crate.result == 'success') && (needs.publish-homebrew-formula.result == 'skipped' || needs.publish-homebrew-formula.result == 'success') }} + if: ${{ always() && needs.host.result == 'success' && (needs.publish-homebrew-formula.result == 'skipped' || needs.publish-homebrew-formula.result == 'success') && (needs.custom-publish-crate.result == 'skipped' || needs.custom-publish-crate.result == 'success') }} runs-on: "ubuntu-22.04" env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/Cargo.toml b/Cargo.toml index 5f63158..5b06697 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -29,10 +29,17 @@ predicates = "3" inherits = "release" lto = "thin" +# Config for 'dist' [workspace.metadata.dist] +# The preferred dist version to use in CI (Cargo.toml SemVer syntax) cargo-dist-version = "0.31.0" -ci = ["github"] +# CI backends to support +ci = "github" +# The installers to generate for each app installers = ["homebrew"] +# A GitHub repo to push Homebrew formulas to tap = "hamsurang/homebrew-deepwiki-cli" +# Publish jobs to run in CI publish-jobs = ["homebrew", "./publish-crate"] +# Target platforms to build apps for (Rust target-triple syntax) targets = ["aarch64-apple-darwin", "x86_64-apple-darwin", "x86_64-unknown-linux-gnu"]