From 090d03759331764b95f4c9cf26334bae1f56d1d7 Mon Sep 17 00:00:00 2001 From: Github Action Date: Tue, 11 Jun 2024 15:31:40 +0000 Subject: [PATCH] Add a the "Add release commits" step --- .buildkite/pipeline.yml | 8 -------- .buildkite/release.yml | 26 +++++++++++++++++++++----- scripts/release-candidate.sh | 35 +++++++++++++++++++---------------- 3 files changed, 40 insertions(+), 29 deletions(-) diff --git a/.buildkite/pipeline.yml b/.buildkite/pipeline.yml index a2f13e3d03d..3813173f556 100644 --- a/.buildkite/pipeline.yml +++ b/.buildkite/pipeline.yml @@ -11,14 +11,6 @@ env: steps: - - label: 'Merge from staging only' - if: 'build.branch == "staging"' - command: './.buildkite/check-bors.sh' - agents: - system: ${linux} - - - wait: ~ - if: 'build.branch == "staging"' - label: 'Check nix (linux)' # Check whether regenerate.sh was applied when it had to be applied. diff --git a/.buildkite/release.yml b/.buildkite/release.yml index 6de0b7a9a47..784e4430bd6 100644 --- a/.buildkite/release.yml +++ b/.buildkite/release.yml @@ -4,12 +4,28 @@ agents: env: LC_ALL: "C.UTF-8" NIX_PATH: "channel:nixos-21.11" - TMPDIR: "/cache" + RELEASE_CANDIDATE_BRANCH: "not set" + RELEASE_COMMIT: "not set" steps: - - label: 'Hello' - key: build-docker - command: | - nix shell .#cardano-wallet -c cardano-wallet version + # - label: 'Check nix (linux)' + # # Check whether regenerate.sh was applied when it had to be applied. + # key: linux-nix + # commands: + # - './nix/regenerate.sh' + # agents: + # system: ${linux} + + - label: Add release commits + key: add-release-commits + # depends_on: linux-nix + commands: | + ./scripts/release-candidate.sh + agents: + system: x86_64-linux + - wait: ~ + - label: 'Check out release commit' + commands: | + git checkout $RELEASE_COMMIT agents: system: x86_64-linux diff --git a/scripts/release-candidate.sh b/scripts/release-candidate.sh index dca7ebf5e07..e3cf4945fe3 100755 --- a/scripts/release-candidate.sh +++ b/scripts/release-candidate.sh @@ -1,6 +1,7 @@ -#! /usr/bin/env bash +#! /usr/bin/env -S nix shell '.#cardano-node' 'nixpkgs#gnused' --command bash +# shellcheck shell=bash -set -euo pipefail +set -euox pipefail # date from git tag # example v2023-04-04 -> 2023-04-04 @@ -13,11 +14,7 @@ tag_cabal_ver() { tag_date "$1" | sed -e s/-0/-/g -e s/-/./g } -BASE_COMMIT=$(curl -X GET -H "Authorization: Bearer ${BUILDKITE_API_TOKEN}" \ - "https://api.buildkite.com/v2/organizations/cardano-foundation/pipelines/cardano-wallet/builds" \ - | jq -r \ - '[.[] | select(.state == "passed" and .branch == "master") | .commit][0]') - +BASE_COMMIT=$(git rev-parse HEAD) echo "BASE_COMMIT=$BASE_COMMIT" today=$(date +%Y-%m-%d) @@ -34,25 +31,31 @@ echo "OLD_GIT_TAG=$OLD_GIT_TAG" OLD_CABAL_VERSION=$(tag_cabal_ver "$OLD_GIT_TAG") echo "OLD_CABAL_VERSION=$OLD_CABAL_VERSION" -CARDANO_NODE_TAG="8.9.3" +CARDANO_NODE_TAG=$(cardano-node version | head -n1 | awk '{print $2}') echo "CARDANO_NODE_TAG=$CARDANO_NODE_TAG" -git checkout "$BASE_COMMIT" +RELEASE_CANDIDATE_BRANCH="release-candidate-new/$NEW_GIT_TAG" +echo "RELEASE_CANDIDATE_BRANCH=$RELEASE_CANDIDATE_BRANCH" git config --global user.email "gha@cardanofoundation.org" git config --global user.name "Github Action" -git checkout -b release-candidate/"$NEW_GIT_TAG" || true +git branch -D "$RELEASE_CANDIDATE_BRANCH" || true +git checkout -b "$RELEASE_CANDIDATE_BRANCH" || true -sed -i "s|version: .*|version: $NEW_GIT_TAG|" specifications/api/swagger.yaml +sed -i "s|version: .*|version: $NEW_GIT_TAG|g" specifications/api/swagger.yaml git commit -m "Update wallet version in swagger.yaml" specifications/api/swagger.yaml -git ls-files '*.cabal' | xargs sed -i "s/$OLD_CABAL_VERSION/$NEW_CABAL_VERSION/" +git ls-files '*.cabal' | xargs sed -i "s|$OLD_CABAL_VERSION|$NEW_CABAL_VERSION|g" git commit -am "Update cardano-wallet version in *.cabal files" -sed -i "s|NODE_TAG=.*|NODE_TAG=$CARDANO_NODE_TAG|" README.md -sed -i "s|WALLET_TAG=.*|WALLET_TAG=$NEW_CABAL_VERSION|" README.md -sed -i "s|WALLET_VERSION=.*|WALLET_VERSION=$NEW_GIT_TAG|" README.md +sed -i "s|NODE_TAG=.*|NODE_TAG=$CARDANO_NODE_TAG|g" README.md +sed -i "s|WALLET_TAG=.*|WALLET_TAG=$NEW_CABAL_VERSION|g" README.md +sed -i "s|WALLET_VERSION=.*|WALLET_VERSION=$NEW_GIT_TAG|g" README.md git commit -am "Update cardano-wallet version in README.md" -git push -f origin release-candidate/"$NEW_GIT_TAG" +RELEASE_COMMIT=$(git rev-parse HEAD) +echo "RELEASE_COMMIT=$RELEASE_COMMIT" + +echo ${GITUB_TOKEN:0:4} +git push -f origin "$RELEASE_CANDIDATE_BRANCH"