From a4c50bd6edef29be5485f1fdecafa2a4534429bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20N=C3=BCtzi?= Date: Sun, 21 Apr 2024 16:09:18 +0200 Subject: [PATCH] fix: Release workflow :anchor: --- .github/workflows/release.yml | 14 ++++++++++++-- nix/pkgs/version.json | 4 +++- scripts/release.sh | 2 +- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 6c24a0cf..7fd8fcea 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -57,25 +57,35 @@ jobs: RELEASE_BRANCH="main" RELEASE_VERSION="${RELEASE_TAG##v}" - regex="^Release-Branch:\s+(.*)$" + echo "Get release branch on tag '$RELEASE_TAG'." + # Gets the message on the annotated commit: deref() { git for-each-ref "refs/tags/$RELEASE_TAG" --format="%($1)" ; }; + git show -s --format="" $RELEASE_TAG + deref contents + + regex="^Release-Branch:\s+(.*)$" if deref contents | grep -qE "$regex"; then RELEASE_BRANCH=$(deref contents | grep -E "$regex" | sed -E "s/$regex/\1/") || { echo "Release-Branch trailer is wrong." exit 1 } + [ -n "$RELEASE_BRANCH" ] || { + echo "Release-Branch trailer is empty." + exit 1 + } fi + # Fetch the branch. git fetch --depth 50 origin "$RELEASE_BRANCH" # Check if its reachable. [ -n "$(git rev-list --first-parent \ - --ancestry-path + --ancestry-path \ "$RELEASE_TAG^..origin/$RELEASE_BRANCH")" ] || { echo "Tag is not reachable from '$RELEASE_BRANCH' (--first-parent) !" >&2 exit 1 diff --git a/nix/pkgs/version.json b/nix/pkgs/version.json index f339f7b9..80cc1aad 100644 --- a/nix/pkgs/version.json +++ b/nix/pkgs/version.json @@ -1 +1,3 @@ -{ "version": "3.0.0" } +{ + "version": "3.0.0-rc1" +} diff --git a/scripts/release.sh b/scripts/release.sh index cddb8bac..2a44a7c1 100755 --- a/scripts/release.sh +++ b/scripts/release.sh @@ -34,7 +34,7 @@ function commit_version_file() { jq ".version |= \"$version\"" nix/pkgs/version.json >"$temp" mv "$temp" nix/pkgs/version.json - if git diff --quiet --exit-code; then + if ! git diff --quiet --exit-code; then git add nix/pkgs/version.json git commit -m "np: Update version to '$version'" fi