From b2a610957610956e4846ca2549fe436e99c0d06e Mon Sep 17 00:00:00 2001 From: Martin Abeleda Date: Fri, 13 Mar 2026 20:40:29 -0700 Subject: [PATCH 1/3] Add cargo publishing metadata and release workflow --- .github/workflows/release.yml | 57 +++++++++++++++++++++++++++++++++++ Cargo.toml | 7 +++++ README.md | 35 +++++++++++++++++++-- 3 files changed, 96 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..a88c7c4 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,57 @@ +name: Release + +on: + push: + tags: + - "v*" + +env: + CARGO_TERM_COLOR: always + +jobs: + publish: + name: Publish to crates.io + runs-on: ubuntu-latest + permissions: + contents: write + steps: + - uses: actions/checkout@v4 + + - uses: dtolnay/rust-toolchain@stable + + - uses: Swatinem/rust-cache@v2 + + - name: Validate tag version matches Cargo.toml + run: | + TAG_VERSION="${GITHUB_REF_NAME#v}" + CARGO_VERSION=$(cargo metadata --no-deps --format-version 1 | python -c 'import json,sys;print(next(p["version"] for p in json.load(sys.stdin)["packages"] if p["name"]=="ripdiff"))') + if [ "$TAG_VERSION" != "$CARGO_VERSION" ]; then + echo "Tag version ($TAG_VERSION) does not match Cargo.toml version ($CARGO_VERSION)" + exit 1 + fi + + - name: Package check + run: cargo package --allow-dirty + + - name: Publish crate + env: + CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} + run: cargo publish --locked + + - name: Generate release notes + run: | + { + echo "## ripdiff $GITHUB_REF_NAME" + echo + echo "Published to crates.io from tag \\`$GITHUB_REF_NAME\\`." + echo + echo "Install with:" + echo "\\`\\`\\`bash" + echo "cargo install ripdiff" + echo "\\`\\`\\`" + } > release-notes.md + + - name: Create GitHub release + uses: softprops/action-gh-release@v2 + with: + body_path: release-notes.md diff --git a/Cargo.toml b/Cargo.toml index b38ec25..793c9f5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,6 +3,13 @@ name = "ripdiff" version = "0.1.0" edition = "2021" default-run = "ripdiff" +description = "Terminal UI for navigating git diffs with optional difftastic integration" +license = "MIT" +repository = "https://github.com/martinabeleda/ripdiff" +readme = "README.md" +keywords = ["git", "diff", "tui", "terminal", "difftastic"] +categories = ["command-line-utilities", "development-tools"] +exclude = [".github/"] [[bin]] name = "ripdiff" diff --git a/README.md b/README.md index 4a5da94..847d8e4 100644 --- a/README.md +++ b/README.md @@ -18,18 +18,47 @@ Uses [difftastic](https://difftastic.wilfred.me/) for structural, syntax-aware d ## Install +### Install from crates.io + +```bash +cargo install ripdiff ``` + +This installs `ripdiff` into `~/.cargo/bin/`. + +### Install from source (local checkout) + +```bash cargo install --path . ``` -This puts `ripdiff` in `~/.cargo/bin/`. - For best results, install difftastic: -``` +```bash cargo install difftastic ``` +## Publishing and release process + +`ripdiff` follows [Semantic Versioning](https://semver.org/) (`MAJOR.MINOR.PATCH`): + +- **PATCH** for bug fixes and internal improvements. +- **MINOR** for backwards-compatible features. +- **MAJOR** for breaking changes. + +### Maintainer release checklist + +1. Bump `version` in `Cargo.toml`. +2. Ensure CI passes (`cargo fmt`, `cargo clippy`, `cargo test`, `cargo build`). +3. Commit and tag the release: + ```bash + git tag vX.Y.Z + git push origin vX.Y.Z + ``` +4. The GitHub Actions release workflow publishes the crate when a `v*` tag is pushed. + +To publish from CI, set a `CARGO_REGISTRY_TOKEN` repository secret with a crates.io API token. + ## Usage Run inside any git repo with uncommitted changes: From 12ebea97f90a4eec053f49bb49bc8b7f12d329d9 Mon Sep 17 00:00:00 2001 From: martinabeleda Date: Fri, 13 Mar 2026 20:56:58 -0700 Subject: [PATCH 2/3] prepare cargo toml for publish --- Cargo.toml | 13 ++++++++++--- README.md | 2 +- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 793c9f5..578c077 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,19 +2,26 @@ name = "ripdiff" version = "0.1.0" edition = "2021" +rust-version = "1.85" default-run = "ripdiff" -description = "Terminal UI for navigating git diffs with optional difftastic integration" +description = "Terminal UI for watching and reviewing agent progress" license = "MIT" repository = "https://github.com/martinabeleda/ripdiff" +homepage = "https://github.com/martinabeleda/ripdiff" +documentation = "https://docs.rs/ripdiff" readme = "README.md" -keywords = ["git", "diff", "tui", "terminal", "difftastic"] +keywords = ["git", "diff", "tui", "review", "agent"] categories = ["command-line-utilities", "development-tools"] -exclude = [".github/"] +include = ["src/**", "Cargo.toml", "README.md", "LICENSE"] [[bin]] name = "ripdiff" path = "src/main.rs" +[[bin]] +name = "rd" +path = "src/main.rs" + [dependencies] ratatui = "0.29" crossterm = "0.28" diff --git a/README.md b/README.md index 847d8e4..55b2b65 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ ░░░░░ ``` -A terminal UI for navigating git diffs, designed for a tmux panel workflow where you monitor AI agent changes on one side while working on the other. +A terminal UI for watching and reviewing agent progress, designed for a tmux panel workflow where you monitor agent changes on one side while working on the other. Uses [difftastic](https://difftastic.wilfred.me/) for structural, syntax-aware diffs with ANSI color output. Falls back to plain `git diff` if difft is not installed. From e4b209b1d5dbbe93b8436fc51e45a60b8f70a69e Mon Sep 17 00:00:00 2001 From: martinabeleda Date: Fri, 13 Mar 2026 21:35:24 -0700 Subject: [PATCH 3/3] add cargo release toml file and RELEASING.md docs --- README.md | 21 ++------------ RELEASING.md | 79 ++++++++++++++++++++++++++++++++++++++++++++++++++++ release.toml | 12 ++++++++ 3 files changed, 93 insertions(+), 19 deletions(-) create mode 100644 RELEASING.md create mode 100644 release.toml diff --git a/README.md b/README.md index 39fefef..dd991cf 100644 --- a/README.md +++ b/README.md @@ -38,26 +38,9 @@ For best results, install difftastic: cargo install difftastic ``` -## Publishing and release process +## Releasing -`ripdiff` follows [Semantic Versioning](https://semver.org/) (`MAJOR.MINOR.PATCH`): - -- **PATCH** for bug fixes and internal improvements. -- **MINOR** for backwards-compatible features. -- **MAJOR** for breaking changes. - -### Maintainer release checklist - -1. Bump `version` in `Cargo.toml`. -2. Ensure CI passes (`cargo fmt`, `cargo clippy`, `cargo test`, `cargo build`). -3. Commit and tag the release: - ```bash - git tag vX.Y.Z - git push origin vX.Y.Z - ``` -4. The GitHub Actions release workflow publishes the crate when a `v*` tag is pushed. - -To publish from CI, set a `CARGO_REGISTRY_TOKEN` repository secret with a crates.io API token. +Maintainer release instructions live in [RELEASING.md](/home/mabeleda/Development/ripdiff/RELEASING.md). ## Usage diff --git a/RELEASING.md b/RELEASING.md new file mode 100644 index 0000000..b2b4764 --- /dev/null +++ b/RELEASING.md @@ -0,0 +1,79 @@ +# Releasing + +This document describes the maintainer release process for `ripdiff`. + +## Versioning + +`ripdiff` follows [Semantic Versioning](https://semver.org/) (`MAJOR.MINOR.PATCH`): + +- `PATCH` for bug fixes and internal improvements. +- `MINOR` for backwards-compatible features. +- `MAJOR` for breaking changes. + +## Release Workflow + +Releases are driven by git tags. + +The GitHub Actions workflow in [.github/workflows/release.yml](/home/mabeleda/Development/ripdiff/.github/workflows/release.yml#L1) runs when a tag matching `v*` is pushed. It: + +1. Checks that the tag version matches `Cargo.toml`. +2. Verifies the crate can be packaged. +3. Publishes the crate to crates.io. +4. Creates a GitHub release for the tag. + +To publish from CI, the repository must have a `CARGO_REGISTRY_TOKEN` secret containing a crates.io API token. + +## Recommended Process + +Use [`cargo-release`](https://github.com/crate-ci/cargo-release) to bump the crate version and create the matching tag in one step. + +Releases should only be cut from `main`. This keeps each published version tied to the reviewed, canonical branch state and avoids accidentally releasing from an unmerged branch or local-only commit. The repository's `cargo-release` configuration enforces this with `allow-branch = ["main"]`. + +Install it once: + +```bash +cargo install cargo-release +``` + +Preview a release: + +```bash +cargo release patch +``` + +Run a release: + +```bash +cargo release patch --execute +``` + +Replace `patch` with `minor` or `major` as needed. + +With the repository configured for `cargo-release`, the executed command should: + +1. Update `Cargo.toml` to the next version. +2. Create a release commit. +3. Create a matching tag like `v0.1.1`. +4. Push the commit and tag to `origin`. + +After the tag is pushed, GitHub Actions performs the actual crates.io publish and creates the GitHub release. + +## Maintainer Checklist + +1. Ensure CI is green locally or on `main`: + ```bash + cargo fmt + cargo clippy --all-targets --all-features + cargo test + cargo build + ``` +2. Run a dry run: + ```bash + cargo release patch + ``` +3. Execute the release: + ```bash + cargo release patch --execute + ``` +4. Verify the GitHub Actions release workflow succeeds. +5. Verify the new version appears on crates.io. diff --git a/release.toml b/release.toml new file mode 100644 index 0000000..e1c0fd1 --- /dev/null +++ b/release.toml @@ -0,0 +1,12 @@ +allow-branch = ["main"] +consolidate-commits = true + +tag-name = "v{{version}}" +tag-message = "ripdiff {{version}}" + +pre-release-commit-message = "release: {{version}}" +push-remote = "origin" + +publish = false +push = true +tag = true