Abbaye

at 44bfea6

[tools]
"aqua:blopker/codebook" = "latest"
"cargo:cargo-readme" = "latest"
"cargo:cargo-semver-checks" = "latest"
git-cliff = "latest"
prek = "latest"
release-plz = "latest"
rust = "1.95"
taplo = "latest"

[env]
RUST_LOG = "abbaye2=trace,info"

[tasks]
run = { alias = "r", run = "cargo run" }

[tasks.init]
description = "Initialize the tooling for this repository."
run = ["mise activate", "prek install -t pre-commit -t pre-merge-commit"]

[tasks.lint]
wait_for = ["fmt", "clean"]
description = "Run various linters"
run = ["taplo check", "cargo clippy", "prek run --all-files"]

[tasks.fmt]
wait_for = ["clean"]
description = "runs various formatters"
run = ["taplo fmt", "cargo fmt"]

[tasks.generate-readme]
description = "generates README.md from the crate-level documentation"
outputs = ["README.md"]
run = [
  "cargo readme --no-indent-headings --no-title > README.md",
  "git add README.md",
]
sources = ["src/main.rs"]

[tasks.generate-changelog]
description = "generates a changelog from git commits"
run = [
  "git-cliff $(if [[ \"${usage_bump:-false}\" == \"true\" ]]; then echo -n '--bump'; fi) --output ${usage_output}",
  "if [[ -n \"${usage_output}\" ]]; then git add ${usage_output}; fi",
]
usage = """
flag "-b --bump" help="bump level"
flag "-o --output <file>" help="output file path" default="CHANGELOG.md"
"""
outputs = ["CHANGELOG.md"]

[tasks.build]
alias = "b"
depends = ["generate-readme", "generate-changelog -o CHANGELOG.md"]
description = "build the project"
run = ["cargo build"]
sources = ["Cargo.toml", "Cargo.lock", "*.rs", "**/*.rs"]

[tasks."build::release"]
wait_for = ["clean", "fmt"]
depends = ["generate-readme", "generate-changelog"]
description = "build the project in release mode"
run = ["cargo build --release"]
sources = ["Cargo.toml", "Cargo.lock", "*.rs", "**/*.rs"]

[tasks.release]
depends = [
  "generate-readme",
  "generate-changelog",
  "build::release",
  "fmt",
  "lint",
  "clean",
]
usage = """
arg "<new_version>" help="New version to release"
"""
confirm = "Are you sure you want to release?"
description = "release the project"
run = [
  'sed -i "s/^version = .*/version = \\\"${usage_new_version}\\\"/" Cargo.toml && git add Cargo.toml',
  "prek run --all-files",
  "git commit -am \"chore: release v${usage_new_version}\"",
  "mise run 'build::release'",
  "git tag --force v${usage_new_version}",
  "mise run generate-changelog && git commit --amend --no-edit -n",
  "git tag --force v${usage_new_version}",
]
sources = ["Cargo.toml", "Cargo.lock", "*.rs", "**/*.rs"]
depends_post = ["deploy-docs"]

[tasks.clean]
description = "cleans the build output"
run = ["cargo clean", "rm -rf public/"]

[tasks.abbaye]
wait_for = ["release", "clean"]
description = "builds the release website"
run = ["cargo run --bin abbaye -- build"]
outputs = ["public/"]

[tasks.deploy-docs]
description = "deploys documentation to https://vit.am/~ololduck/abbaye"
depends = ["abbaye", "clean"]
run = [
  "rsync --progress -avz --links --perms --update public/ ololduck@vit.am:public_html/abbaye/",
]
sources = ["public/"]