From a0b4de25e2db2a48a73ed23e7537952cef384b80 Mon Sep 17 00:00:00 2001 From: Robin Hahling Date: Mon, 7 Jun 2021 10:24:28 +0200 Subject: [PATCH] add stable.txt [ cherry-picked from cilium/cilium repository ] Add `stable.txt`, a file in the master branch that always points to the latest stable release of Cilium. This file can be used as a reference by tools such as the Cilium CLI to get the latest stable release version. This pattern and file is already applied to the Hubble CLI repository. Ultimately, this new file will allow the Cilium CLI to always install the latest version of Cilium, as initially planned[0], instead of the version hardcoded in the CLI binary. [0]: https://github.com/cilium/cilium-cli/pull/121#issuecomment-800429382 Co-authored-by: Joe Stringer Signed-off-by: Robin Hahling Signed-off-by: Joe Stringer Signed-off-by: Quentin Monnet --- internal/bump-readme.sh | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/internal/bump-readme.sh b/internal/bump-readme.sh index 8e974c6..3998de7 100755 --- a/internal/bump-readme.sh +++ b/internal/bump-readme.sh @@ -13,10 +13,16 @@ PROJECTS_REGEX='s/.*projects\/\([0-9]\+\).*/\1/' ACTS_YAML=".github/cilium-actions.yml" REMOTE="$(get_remote)" +latest_stable="" for release in $(grep "General Announcement" README.rst \ | sed 's/.*tree\/\(v'"$MAJ_REGEX"'\).*/\1/'); do latest=$(git describe --tags $REMOTE/$release \ | sed 's/v//' | sed 's/\('"$MIN_REGEX"'\).*/\1/') + if [ -z "$latest_stable" ]; then + # the first release in the list is the latest stable + latest_stable=$latest + echo "v$latest_stable" > stable.txt + fi if grep -q -F $latest README.rst; then continue fi @@ -39,5 +45,10 @@ for release in $(grep "General Announcement" README.rst \ sed -i 's/\(projects\/\)'$old_proj'/\1'$new_proj'/g' $ACTS_YAML done -git add README.rst $ACTS_YAML -git commit -s -m "Update stable releases" +git add README.rst stable.txt $ACTS_YAML +if ! git diff-index --quiet HEAD -- README.rst stable.txt $ACTS_YAML; then + git commit -s -m "Update stable releases" + echo "README.rst and stable.txt updated, submit the PR now." +else + echo "No new releases found." +fi