Skip to content

Commit

Permalink
chore: Add release script
Browse files Browse the repository at this point in the history
  • Loading branch information
Dustin Blackman committed Dec 1, 2023
1 parent ddca279 commit 2b10208
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 23 deletions.
1 change: 0 additions & 1 deletion .cargo/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,4 @@ dist = ["bin", "cargo-dist"]
insta = ["bin", "cargo-insta"]
llvm-cov = ["bin", "cargo-llvm-cov"]
nextest = ["bin", "cargo-nextest"]
release = ["bin", "cargo-release"]
watch = ["bin", "cargo-watch"]
39 changes: 17 additions & 22 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ cargo-dist = { version = "0.1.0-prerelease.10" }
cargo-insta = { version = "1.31.0", locked = true }
cargo-llvm-cov = { version = "0.5.25" }
cargo-nextest = { version = "0.9.57", locked = true }
cargo-release = { version = "0.24.11" }
cargo-watch = { version = "8.4.0" }
committed = { version = "1.0.20" }
dprint = { version = "0.40.2" }
Expand All @@ -60,27 +59,6 @@ strip = "symbols"
[profile.dist]
inherits = "release"

# Config for 'cargo dist'
[workspace.metadata.dist]
cargo-dist-version = "0.1.0-prerelease.10"
ci = ["github"]
installers = []
targets = [
"x86_64-unknown-linux-gnu",
"x86_64-apple-darwin",
"aarch64-apple-darwin",
]
unix-archive = ".tar.gz"

# Config for 'cargo release'
[package.metadata.release]
pre-release-hook = [
"bash",
"-c",
"cargo cmd lint && cargo cmd test && cargo bin git-cliff -o CHANGELOG.md --tag {{version}} && cargo bin dprint fmt",
]
allow-branch = ["master"]

[package.metadata.commands]
lint = '''set -e
cargo cmd setup-nightly
Expand All @@ -104,6 +82,23 @@ setup-nightly = '''
rustup toolchain link runbin-nightly "$(rustup toolchain list -v | grep $NIGHTLY | grep '^nightly-' | awk '{print $2}')"
'''

release = '''set -e
export RB_VERSION=$(cat Cargo.toml | grep version | head -n1 | awk -F '"' '{print $2}')
cargo check
cargo bin git-cliff -o CHANGELOG.md --tag "v$RB_VERSION"
git add .
git commit -m "feat: Release v$RB_VERSION"
git tag -a "v$RB_VERSION" -m "v$RB_VERSION"
git push
git push --tags
gh release create "v$RB_VERSION" --generate-notes
cargo bin git-cliff --latest --strip header | cargo bin dprint fmt --stdin md | cargo gha gh release edit "v$RB_VERSION" --notes-file -
'''

test-coverage = '''set -e
cargo build
cargo llvm-cov nextest --ignore-filename-regex='_test.rs'
Expand Down

0 comments on commit 2b10208

Please sign in to comment.