From e1cb948bd6617792bc90cb1b5d8468cc58c9d9be Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 17 Jan 2026 23:28:44 +0000 Subject: [PATCH 1/2] ci: add cargo publish workflow - Add publish.yml workflow triggered on version tags (v*) - Support manual workflow dispatch with dry-run option - Publish fetchkit library first, then fetchkit-cli - Run tests before publishing - Add version dependency to fetchkit-cli for crates.io compatibility --- .github/workflows/publish.yml | 102 +++++++++++++++++++++++++++++++++ crates/fetchkit-cli/Cargo.toml | 2 +- 2 files changed, 103 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/publish.yml diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..0b3ba1f --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,102 @@ +name: Publish to crates.io + +on: + push: + tags: + - 'v[0-9]+.[0-9]+.[0-9]+' + - 'v[0-9]+.[0-9]+.[0-9]+-*' + workflow_dispatch: + inputs: + dry_run: + description: 'Dry run (no actual publish)' + required: false + default: 'true' + type: boolean + crate: + description: 'Crate to publish (all, fetchkit, fetchkit-cli)' + required: false + default: 'all' + type: choice + options: + - all + - fetchkit + - fetchkit-cli + +permissions: + contents: read + +env: + CARGO_TERM_COLOR: always + RUST_BACKTRACE: 1 + +jobs: + test: + name: Test before publish + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@stable + - uses: Swatinem/rust-cache@v2 + - name: Run tests + run: cargo test --workspace + - name: Check formatting + run: cargo fmt --all -- --check + - name: Clippy + run: cargo clippy --workspace --all-targets -- -D warnings + + publish-fetchkit: + name: Publish fetchkit + needs: test + runs-on: ubuntu-latest + if: >- + github.event_name == 'push' || + (github.event_name == 'workflow_dispatch' && + (github.event.inputs.crate == 'all' || github.event.inputs.crate == 'fetchkit')) + steps: + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@stable + - uses: Swatinem/rust-cache@v2 + + - name: Verify crate can be packaged + run: cargo package -p fetchkit --allow-dirty + + - name: Publish fetchkit (dry run) + if: github.event_name == 'workflow_dispatch' && github.event.inputs.dry_run == 'true' + run: cargo publish -p fetchkit --dry-run + + - name: Publish fetchkit + if: github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && github.event.inputs.dry_run == 'false') + run: cargo publish -p fetchkit + env: + CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} + + publish-fetchkit-cli: + name: Publish fetchkit-cli + needs: [test, publish-fetchkit] + runs-on: ubuntu-latest + if: >- + github.event_name == 'push' || + (github.event_name == 'workflow_dispatch' && + (github.event.inputs.crate == 'all' || github.event.inputs.crate == 'fetchkit-cli')) + steps: + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@stable + - uses: Swatinem/rust-cache@v2 + + # Wait for crates.io index to update after fetchkit publish + - name: Wait for crates.io index + if: github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && github.event.inputs.dry_run == 'false') + run: sleep 30 + + - name: Verify crate can be packaged + run: cargo package -p fetchkit-cli --allow-dirty + + - name: Publish fetchkit-cli (dry run) + if: github.event_name == 'workflow_dispatch' && github.event.inputs.dry_run == 'true' + run: cargo publish -p fetchkit-cli --dry-run + + - name: Publish fetchkit-cli + if: github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && github.event.inputs.dry_run == 'false') + run: cargo publish -p fetchkit-cli + env: + CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} diff --git a/crates/fetchkit-cli/Cargo.toml b/crates/fetchkit-cli/Cargo.toml index 66acfe9..02ff521 100644 --- a/crates/fetchkit-cli/Cargo.toml +++ b/crates/fetchkit-cli/Cargo.toml @@ -12,7 +12,7 @@ name = "fetchkit" path = "src/main.rs" [dependencies] -fetchkit = { path = "../fetchkit" } +fetchkit = { version = "0.1.0", path = "../fetchkit" } tokio = { workspace = true } clap = { workspace = true } serde = { workspace = true } From a9a273a40e8c72d74eefe5b5fe3bc5a1f238fdb7 Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 18 Jan 2026 01:23:54 +0000 Subject: [PATCH 2/2] docs: document cargo publish workflow in AGENTS.md - Add "Publishing to crates.io" section with workflow details - Document triggers, process, requirements, and release steps - Add fetchers.md to available specs list --- AGENTS.md | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/AGENTS.md b/AGENTS.md index 02bb97b..34b6c9d 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -33,6 +33,7 @@ Key capabilities: Available specs: - `specs/initial.md` - WebFetch tool specification (types, behavior, conversions, error handling) +- `specs/fetchers.md` - Pluggable fetcher system for URL-specific handling Specification format: Abstract and Requirements sections. @@ -91,6 +92,36 @@ specs/ # Feature specifications - Clippy runs with `-D warnings` (warnings are errors) - Doc builds must not have warnings +### Publishing to crates.io + +Workflow: `.github/workflows/publish.yml` + +Triggers: +- Push version tag: `v*.*.*` or `v*.*.*-*` (e.g., `v0.1.0`, `v0.2.0-beta.1`) +- Manual workflow dispatch with dry-run option + +Process: +1. Runs tests, fmt check, and clippy +2. Publishes `fetchkit` library first +3. Waits for crates.io index update +4. Publishes `fetchkit-cli` + +Requirements: +- `CARGO_REGISTRY_TOKEN` secret must be configured in repo settings +- Crate metadata (name, version, description, license, repository) in Cargo.toml + +Release steps: +```bash +# 1. Update version in Cargo.toml (workspace level) +# 2. Commit version bump +git commit -am "chore: bump version to 0.2.0" +# 3. Create and push tag +git tag v0.2.0 +git push origin main --tags +``` + +Note: `fetchkit-python` is not published to crates.io (uses PyPI distribution instead). + ### Cloud Agent environments When running in cloud-hosted agent environments (e.g., Claude Code on the web), the following secrets are available: