diff --git a/.circleci/config.yml b/.circleci/config.yml index 7be3e4fb9830..376c1b2bf4b1 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -316,6 +316,11 @@ 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, + # 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 + 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 +350,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" @@ -382,8 +379,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 diff --git a/scripts/create_release_branch.sh b/scripts/create_release_branch.sh new file mode 100755 index 000000000000..07199ab5304e --- /dev/null +++ b/scripts/create_release_branch.sh @@ -0,0 +1,23 @@ +#!/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" +python scripts/update_version.py "$VERSION" +git commit --all --message="Up version to ${VERSION}" +git push origin "$VERSION_BRANCH"