From 7125da01b0191fdb80fdaac8ac749d1d6c384d30 Mon Sep 17 00:00:00 2001 From: Amanda Walker Date: Tue, 17 May 2022 11:12:45 -0700 Subject: [PATCH 1/6] Don't commit RC bumps to release branch --- .circleci/config.yml | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 7be3e4fb9830..9c3ed1db6e82 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -316,6 +316,10 @@ jobs: - run: name: Set final versions for pre-release and update version command: | + # Start at the latest existing RC for this version if one exists + export LATEST_MATCHING_RC=$(curl https://pypi.org/pypi/streamlit/json | jq ".releases | keys | map(select(contains(\"rc\"))) | map(select(contains(\"$DESIRED_VERSION\"))) | sort | .[-1]") + if [ $LATEST_MATCHING_RC ]; then python scripts/update_version.py $LATEST_MATCHING_RC; fi + export STREAMLIT_RELEASE_SEMVER=$(python scripts/get_prerelease_version.py $DESIRED_VERSION) echo 'export STREAMLIT_RELEASE_SEMVER=$(python scripts/get_prerelease_version.py $DESIRED_VERSION)' >> $BASH_ENV echo 'export STREAMLIT_RELEASE_VERSION=$(echo $STREAMLIT_RELEASE_SEMVER | sed s/\-rc\./rc/)' >> $BASH_ENV @@ -345,14 +349,6 @@ jobs: command: | make distribute - - run: - name: Commit version updates - command: | - git config user.email "core+streamlitbot-github@streamlit.io" - git config user.name "Streamlit Bot" - - git commit -am "Up version to $STREAMLIT_RELEASE_VERSION [skip ci]" && git push origin $CIRCLE_BRANCH || echo "No changes to commit" - - slack/status: success_message: ":rocket: Release of RC version ${STREAMLIT_RELEASE_SEMVER} was successful!" failure_message: ":blobonfire: Release of RC version ${STREAMLIT_RELEASE_SEMVER} failed" From b89759ba22ffebc0e56be9dcd187aeddd63c5d2c Mon Sep 17 00:00:00 2001 From: Amanda Walker Date: Tue, 17 May 2022 18:19:06 -0700 Subject: [PATCH 2/6] Look up release PR a more robust way Readability down, working for PRs with no unique commits up --- .circleci/config.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 9c3ed1db6e82..87d52f959b3c 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -378,8 +378,8 @@ jobs: name: Look up the related GitHub PR number and branch name command: | eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)" - echo "export GH_PR_NUMBER=$(gh api repos/${GH_REPO}/commits/${CIRCLE_SHA1}/pulls | jq '.[0] | .number')" >> $BASH_ENV - echo "export GH_PR_BRANCH=$(gh api repos/${GH_REPO}/commits/${CIRCLE_SHA1}/pulls | jq '.[0] | .head.ref')" >> $BASH_ENV + echo "export GH_PR_NUMBER=$(gh api repos/${GH_REPO}/pulls | jq '[.[] | select(.head.label | contains(\"release/\"))] | .[0] | .number')" >> $BASH_ENV + echo "export GH_PR_BRANCH=$(gh api repos/${GH_REPO}/pulls | jq '[.[] | select(.head.label | contains(\"release/\"))] | .[0] | .head.ref')" >> $BASH_ENV - run: name: Ensure that version tag matches branch version From 3f4b70a71dd13f35eb08ee776de2fb0fba1bb327 Mon Sep 17 00:00:00 2001 From: Amanda Walker Date: Wed, 18 May 2022 15:07:51 -0700 Subject: [PATCH 3/6] Add script for creating release branch --- scripts/create_release_branch.sh | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100755 scripts/create_release_branch.sh diff --git a/scripts/create_release_branch.sh b/scripts/create_release_branch.sh new file mode 100755 index 000000000000..613e11d79db0 --- /dev/null +++ b/scripts/create_release_branch.sh @@ -0,0 +1,22 @@ +#!/bin/sh +# Copyright 2018-2022 Streamlit Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +set -euo pipefail + +VERSION=$1 +VERSION_BRANCH="release/${VERSION}" + +git switch --create "$VERSION_BRANCH" +git commit --allow-empty --message="Release branch for ${VERSION}" +git push --dry-run origin "$VERSION_BRANCH" From a64c52b91543c97d1e08ff3965576cbc18b87c37 Mon Sep 17 00:00:00 2001 From: Amanda Walker Date: Thu, 19 May 2022 13:32:45 -0700 Subject: [PATCH 4/6] Actually push created release branch --- scripts/create_release_branch.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/create_release_branch.sh b/scripts/create_release_branch.sh index 613e11d79db0..57224b0122c1 100755 --- a/scripts/create_release_branch.sh +++ b/scripts/create_release_branch.sh @@ -19,4 +19,4 @@ VERSION_BRANCH="release/${VERSION}" git switch --create "$VERSION_BRANCH" git commit --allow-empty --message="Release branch for ${VERSION}" -git push --dry-run origin "$VERSION_BRANCH" +git push origin "$VERSION_BRANCH" From 19ea63559ef88b2db7c4ccd81b6b0b56925e1c82 Mon Sep 17 00:00:00 2001 From: Amanda Walker Date: Thu, 19 May 2022 15:50:22 -0700 Subject: [PATCH 5/6] Use version bump commit for release branch creation --- scripts/create_release_branch.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/create_release_branch.sh b/scripts/create_release_branch.sh index 57224b0122c1..07199ab5304e 100755 --- a/scripts/create_release_branch.sh +++ b/scripts/create_release_branch.sh @@ -18,5 +18,6 @@ VERSION=$1 VERSION_BRANCH="release/${VERSION}" git switch --create "$VERSION_BRANCH" -git commit --allow-empty --message="Release branch for ${VERSION}" +python scripts/update_version.py "$VERSION" +git commit --all --message="Up version to ${VERSION}" git push origin "$VERSION_BRANCH" From 90965467d5db85cf9e43f0760690ce4edd54dd2b Mon Sep 17 00:00:00 2001 From: Amanda Walker Date: Mon, 23 May 2022 12:50:56 -0700 Subject: [PATCH 6/6] Add more explanation of RC version updates --- .circleci/config.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 87d52f959b3c..376c1b2bf4b1 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -316,7 +316,8 @@ jobs: - run: name: Set final versions for pre-release and update version command: | - # Start at the latest existing RC for this version if one exists + # Start at the latest existing RC for this version if one exists, + # so the following update will increment to the right RC version export LATEST_MATCHING_RC=$(curl https://pypi.org/pypi/streamlit/json | jq ".releases | keys | map(select(contains(\"rc\"))) | map(select(contains(\"$DESIRED_VERSION\"))) | sort | .[-1]") if [ $LATEST_MATCHING_RC ]; then python scripts/update_version.py $LATEST_MATCHING_RC; fi