Skip to content
This repository has been archived by the owner on Jan 8, 2025. It is now read-only.

docs: add bump hook recipes #10

Merged
merged 1 commit into from
Mar 9, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 48 additions & 0 deletions src/guide/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -756,6 +756,54 @@ pre_bump_hooks = [
```
:::

### Bump hook recipes

#### Cargo library projects

A recipe for Cargo projects with a git-ignored `Cargo.lock` file, aka library projects.

Prerequisites:

- `cargo-edit`

Hooks:

```toml
pre_bump_hooks = [
"cargo build --release", # verify the project builds
"cargo set-version {{version}}", # bump version in Cargo.toml
]
post_bump_hooks = [
"git push",
"git push {{version}}",
]
```

#### Cargo executable projects

A recipe for Cargo projects with a managed `Cargo.lock` file, aka executable projects.
Notably, the version bump is also included in the lockfile by running `cargo check`
and then staging the change before creating the bump commit.

Prerequisites:

- `cargo-edit`

Hooks:

```toml
pre_bump_hooks = [
"cargo build --release", # verify the project builds
"cargo set-version {{version}}", # bump version in Cargo.toml
"cargo check --release",
"git add :/Cargo.lock", # stage version bump in Cargo.lock
]
post_bump_hooks = [
"git push",
"git push {{version}}",
]
```

## Tag prefix

It is common to use a tag prefix when creating version in your repository. This is described in the [SemVer specification
Expand Down