Skip to content

Commit

Permalink
Add a the "Add release commits" step
Browse files Browse the repository at this point in the history
  • Loading branch information
Github Action committed Jun 12, 2024
1 parent f3d0fdb commit 090d037
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 29 deletions.
8 changes: 0 additions & 8 deletions .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
26 changes: 21 additions & 5 deletions .buildkite/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
35 changes: 19 additions & 16 deletions scripts/release-candidate.sh
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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)
Expand All @@ -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 "[email protected]"
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"

0 comments on commit 090d037

Please sign in to comment.