Skip to content

Commit

Permalink
docs(hook): add documentation for version hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
oknozor committed Oct 10, 2020
1 parent 42827f0 commit cf5419c
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
18 changes: 17 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,23 @@ You might also need to adjust `changelog_path` in `cog.toml`.

## Run pre bump hook

*Comming soon*
Creating git tag automatically is great but sometimes you need to edit some file with the new version number,
or perform some additional checks before doing so.

A typical example is editing your project manifest in your package manager configuration file.
You can run pre bump commands with the `%version` alias to reference the newly created version :

```toml
# cog.toml
hooks = [
"cargo build --release",
"cargo bump %version",
]
```

When running `cog bump` these command will be run before creating the version commit.
Assuming we are bumping to `1.1.0`, the `%version` alias will be replaced with `1.1.0`.


### Install pre commit hook

Expand Down
5 changes: 4 additions & 1 deletion cog.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@ changelog_path = "CHANGELOG.md"
# A list of command to run before creating a version.
# All change generated by those commands will be committed with the generated version commit.
# `%version` will be interpretted as your target version
hooks = ["cargo bump %version"]
hooks = [
"cargo build --release",
"cargo bump %version",
]

# An optional list of additional allowed commit type
# `coco {commit_type}` commit command will be generated at runtime
Expand Down

0 comments on commit cf5419c

Please sign in to comment.