Skip to content

Commit

Permalink
[ADP-3237] automate release candidate branching (#4371)
Browse files Browse the repository at this point in the history
- [x] Remove unused rc-latest GH workflow
- [x] Add a `release-candidate.sh` script that
       - Search for last green CI-1 build on master
- Forks a branch named `release-candidate/v\<YYYY-MM-DD\>` with today's
date
       - Add release tweaks (version bumps)
       - Pushes the new branch to origin
- [x] Create a release-candidate fork github workflow that forks every
day at 20:00 and run the `release-candidate.sh` script
- [x] Remove the release table in `README.md` as difficult to keep
update. The link to the releases is preserved.

ADP-3237
  • Loading branch information
paolino authored Dec 21, 2023
2 parents a880b1e + 4e7b1a4 commit a78095a
Show file tree
Hide file tree
Showing 4 changed files with 77 additions and 37 deletions.
27 changes: 0 additions & 27 deletions .github/workflows/rc-tag-update.yml

This file was deleted.

18 changes: 18 additions & 0 deletions .github/workflows/release-candidate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Release candidate daily fork
on:
schedule:
- cron: '0 20 * * *'
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4.1.1
with:
fetch-tags: true
fetch-depth: 0
- run: ./scripts/release-candidate.sh
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BUILDKITE_API_TOKEN: ${{ secrets.BUILDKITE_TOKEN_READ_BUILDS_ARTIFACTS }}
11 changes: 1 addition & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ docker-compose up
docker-compose down
```

Fantastic! The server is up-and-running, waiting for HTTP requests on `localhost:8090/v2` e.g.:
Fantastic! server is up-and-running, waiting for HTTP requests on `localhost:8090`

```
curl http://localhost:8090/v2/network/information
Expand All @@ -128,15 +128,6 @@ NixOS users can also use the [NixOS service](https://cardano-foundation.github.i

We provide executables as part of our [releases](https://github.com/cardano-foundation/cardano-wallet/releases). Please also see the installation instructions highlighted in the release notes.

> **Latest releases**
>
> | cardano-wallet | cardano-node (compatible versions) |
> | --- | --- |
> | [v2023-12-18](https://github.com/cardano-foundation/cardano-wallet/releases/tag/v2023-12-18) | [8.1.2](https://github.com/input-output-hk/cardano-node/releases/tag/8.1.2) |
> | [v2023-07-18](https://github.com/cardano-foundation/cardano-wallet/releases/tag/v2023-07-18) | [8.1.1](https://github.com/input-output-hk/cardano-node/releases/tag/8.1.1) |
> | [v2023-04-14](https://github.com/cardano-foundation/cardano-wallet/releases/tag/v2023-04-14) | [1.35.4](https://github.com/input-output-hk/cardano-node/releases/tag/1.35.4) |
> | [v2022-12-14](https://github.com/cardano-foundation/cardano-wallet/releases/tag/v2022-12-14) | [1.35.4](https://github.com/input-output-hk/cardano-node/releases/tag/1.35.4) |
### Building from source

See [Building](https://cardano-foundation.github.io/cardano-wallet/contributor/what/building.html)
Expand Down
58 changes: 58 additions & 0 deletions scripts/release-candidate.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
#! /usr/bin/env bash

set -euo pipefail

# date from git tag
# example v2023-04-04 -> 2023-04-04
tag_date() {
echo "${1##v}"
}
# cabal version from git tag
# example v2023-04-04 -> 2023.4.4
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]')

echo "BASE_COMMIT=$BASE_COMMIT"

today=$(date +%Y-%m-%d)

NEW_GIT_TAG=v$today
echo "NEW_GIT_TAG=$NEW_GIT_TAG"

NEW_CABAL_VERSION=$(tag_cabal_ver "$NEW_GIT_TAG")
echo "NEW_CABAL_VERSION=$NEW_CABAL_VERSION"

OLD_GIT_TAG=$( git tag -l "v2*-*-*" | sort | tail -n1)
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.1.2"
echo "CARDANO_NODE_TAG=$CARDANO_NODE_TAG"

git checkout "$BASE_COMMIT"

git config --global user.email "gha@cardanofoundation.org"
git config --global user.name "Github Action"

git checkout -b release-candidate/"$NEW_GIT_TAG" || true

sed -i "s|version: .*|version: $NEW_GIT_TAG|" 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 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
git commit -am "Update cardano-wallet version in README.md"

git push -f origin release-candidate/"$NEW_GIT_TAG"

0 comments on commit a78095a

Please sign in to comment.