11#!/usr/bin/env nu
22
3+ use std
4+
35# Tags the most recent commit as a new release. Fails if the version has not been bumped because the tag will already exist
46def main [] {
7+ std log info $" Running in: (pwd )"
8+
59 # Ensure the working tree is clean
610 if ((git status -- porcelain | str trim ) != " " ) {
711 print " Uncommitted changes detected. Exiting script."
@@ -19,27 +23,38 @@ def main [] {
1923 let version = ($cargo_toml_contents | get package.version )
2024 let crate_name = ($cargo_toml_contents | get package.name )
2125 let tag_name = $" ($crate_name )_v($version )"
26+ std log info $" Crate name: ($crate_name )"
27+ std log info $" Tag name: ($tag_name )"
2228
2329 # Ensure not a dev version
2430 if " dev" in $tag_name {
2531 print $" Error: Current version is a development version. NOT tagged: ($tag_name )"
2632 exit 1
2733 }
28-
34+
2935 # Ensure we are on the main branch
3036 let current_branch = (git branch -- show-current | str trim )
31-
3237 if $current_branch != " main" {
3338 print $" Error: You are on branch '($current_branch )', not 'main'."
3439 exit 1
3540 }
36-
41+
3742 # Ensure cargo-semver-checks passes
43+ std log info " Cheap checks completed moving on to do semver-checks"
3844 cargo semver-checks
3945
46+ std log info " Executing deployment..."
47+
48+ std log info " Doing git push..."
4049 git push
50+
51+ std log info " Creating Tag..."
4152 git tag $tag_name
53+
54+ std log info " Pushing Tag..."
4255 git push -- tags
56+
57+ std log info " Running cargo publish..."
4358 cargo publish
44- print $" Tag ($tag_name ) created successfully and pushed"
59+ print $" Tag ($tag_name ) created successfully and pushed"
4560}
0 commit comments