From c5991389822fcc810bd223f9215d6da11af11e7a Mon Sep 17 00:00:00 2001 From: Gerald Pinder Date: Mon, 22 Apr 2024 16:49:14 -0400 Subject: [PATCH] chore: Prepare justfile for release --- Cargo.toml | 3 ++- justfile | 58 ++++++++++----------------------------------- recipe/Cargo.toml | 2 +- template/Cargo.toml | 2 +- utils/Cargo.toml | 2 +- 5 files changed, 18 insertions(+), 49 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index d96ae087..1f521557 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -7,6 +7,7 @@ edition = "2021" repository = "https://github.com/blue-build/cli" license = "Apache-2.0" categories = ["command-line-utilities"] +version = "0.8.3" [workspace.dependencies] anyhow = "1" @@ -36,8 +37,8 @@ module_name_repetitions = "allow" [package] name = "blue-build" build = "build.rs" -version = "0.8.3" +version.workspace = true edition.workspace = true description.workspace = true repository.workspace = true diff --git a/justfile b/justfile index 56fdac81..16cf047a 100644 --- a/justfile +++ b/justfile @@ -3,58 +3,26 @@ export RUST_BACKTRACE := "1" set dotenv-load := true -set shell := ["bash", "-cu"] +set shell := ["bash", "-xeu", "-o", "pipefail", "-c"] set positional-arguments := true # default recipe to display help information default: @just --list -# release: remove the dev suffix, like going from 0.X.0-dev to 0.X.0 -# --workspace: updating all crates in the workspace -# --no-publish: do not publish to crates.io -# --execute: not a dry run -# --no-tag: do not push tag for each new version -# --no-push: do not push the update commits -# --dependent-version upgrade: change 0.X.0-dev in internal dependencies to 0.X.0 -# --exclude: ignore those packages -cargo-release *args: - #!/usr/bin/env bash - set -euo pipefail - - cargo release release -v \ +# release: Run cargo release and push the tag separately +release *args: + # --workspace: updating all crates in the workspace + # --no-tag: do not push tag for each new version + # --no-confirm: don't look for user input, just run the command + # --execute: not a dry run + cargo release $1 -v \ --workspace \ - --no-publish \ --no-tag \ --no-confirm \ - --no-push \ - --dependent-version upgrade "$@" - -# See @cargo-release for meaning of cargo-release arguments -cargo-post-release *args: - #!/usr/bin/env bash - set -euo pipefail - - # Read the current version from Cargo.toml - current_version=$(cargo metadata --format-version 1 --no-deps | \ - jq --raw-output '.packages | .[] | select(.name == "blue-build").version') - - echo "Current Version: $current_version" - - # Sanity check: current version should be 0.X.Y - if ! grep -q '^0\.[0-9]\+\.[0-9]\+$' <<< "${current_version}"; then - echo "Invalid version (not in 0.X.Y format): ${current_version}" - exit 1 - fi - - minor_version=$(sed 's/^0\.\([0-9]\+\).*/\1/' <<< "${current_version}") - next_version=0.$((minor_version + 1)).0-dev - echo "Bumping version to ${next_version}" + --execute - # See @cargo-release for meaning of these arguments - cargo release -v "${next_version}" \ - --workspace \ - --no-publish \ - --no-tag \ - --no-confirm \ - --no-push "$@" + VERSION=$(cargo metadata --format-version 1 | jq -r '.packages[] | select(.name == "blue-build") .version') + echo "Pushing tag: v${VERSION}" + git tag "v${VERSION}" + git push origin "v${VERSION}" diff --git a/recipe/Cargo.toml b/recipe/Cargo.toml index 504f8c77..90ea3016 100644 --- a/recipe/Cargo.toml +++ b/recipe/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "blue-build-recipe" -version = "0.8.3" +version.workspace = true edition.workspace = true description.workspace = true repository.workspace = true diff --git a/template/Cargo.toml b/template/Cargo.toml index cfee3306..d7fa5b87 100644 --- a/template/Cargo.toml +++ b/template/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "blue-build-template" -version = "0.8.3" +version.workspace = true edition.workspace = true description.workspace = true repository.workspace = true diff --git a/utils/Cargo.toml b/utils/Cargo.toml index cf6e049d..f406eed5 100644 --- a/utils/Cargo.toml +++ b/utils/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "blue-build-utils" -version = "0.8.3" +version.workspace = true edition.workspace = true description.workspace = true repository.workspace = true