diff --git a/.github/workflows/release-candidate.yml b/.github/workflows/release-candidate.yml deleted file mode 100644 index 65543fdb7e23..000000000000 --- a/.github/workflows/release-candidate.yml +++ /dev/null @@ -1,118 +0,0 @@ -name: Release Candidate - -on: - # Manual Trigger GH CLI -> gh workflow run release-candidate.yml --ref - workflow_dispatch: - -jobs: - run-python-tests: - uses: ./.github/workflows/python-versions.yml - with: - ref: ${{ github.ref_name }} - secrets: - PARAMETER_PASSWORD: ${{ secrets.PARAMETER_PASSWORD }} - - run-javascript-tests: - uses: ./.github/workflows/js-tests.yml - with: - ref: ${{ github.ref_name }} - - run-py-prod-deps-smoke-test: - uses: ./.github/workflows/py-prod-deps-smoke-test.yml - with: - ref: ${{ github.ref_name }} - - run-cypress-tests: - uses: ./.github/workflows/cypress.yml - with: - ref: ${{ github.ref_name }} - - run-playwright-tests: - uses: ./.github/workflows/playwright.yml - with: - ref: ${{ github.ref_name }} - - build-release-candidate: - runs-on: ubuntu-latest - - needs: - - run-python-tests - - run-javascript-tests - - run-py-prod-deps-smoke-test - - run-cypress-tests - - run-playwright-tests - - defaults: - run: - shell: bash --login -eo pipefail {0} - - env: - # We don't want to use constraints files because they might not exist yet. - USE_CONSTRAINTS_FILE: "false" - - steps: - - name: Checkout Streamlit code - uses: actions/checkout@v4 - with: - ref: ${{ github.ref_name }} - persist-credentials: false - submodules: "recursive" - fetch-depth: 2 - - name: Set Python version vars - uses: ./.github/actions/build_info - - name: Set up Python ${{ env.PYTHON_MAX_VERSION }} - uses: actions/setup-python@v4 - with: - python-version: "${{ env.PYTHON_MAX_VERSION }}" - - name: Setup virtual env - uses: ./.github/actions/make_init - # Uses action to safely process user input (branch name) to prevent script injection attacks - - name: Set Environment Variables - uses: ./.github/actions/branch - with: - branch: ${{ github.ref_name }} - - name: Set desired version from branch name - env: - BRANCH: ${{ env.BRANCH }} - run: | - echo "DESIRED_VERSION=$(echo "${BRANCH}" | sed 's/release\///')" >> $GITHUB_ENV - - name: Set final versions for pre-release and update version - env: - DESIRED_VERSION: ${{ env.DESIRED_VERSION }} - run: | - LATEST_MATCHING_RC=$(python scripts/get_latest_release_candidate.py) - if [ "$LATEST_MATCHING_RC" != "None" ]; then python scripts/update_version.py "$LATEST_MATCHING_RC"; fi - - STREAMLIT_RELEASE_SEMVER=$(python scripts/get_prerelease_version.py "$DESIRED_VERSION") - echo "STREAMLIT_RELEASE_VERSION=$(echo "$STREAMLIT_RELEASE_SEMVER" | sed s/\-rc\./rc/)" >> $GITHUB_ENV - python scripts/update_version.py "$STREAMLIT_RELEASE_SEMVER" - - name: Create Package - timeout-minutes: 120 - run: | - sudo apt install rsync - make package - - name: Run CLI regression tests - run: make cli-regression-tests - - name: Store Package - uses: actions/upload-artifact@v3 - with: - name: Release-Candidate - path: lib/dist - - name: Upload to PyPI - env: - TWINE_USERNAME: ${{ secrets.STREAMLIT_PYPI_USERNAME }} - TWINE_PASSWORD: ${{ secrets.STREAMLIT_PYPI_API_TOKEN }} - run: | - make distribute - - name: Successful Release Candidate Slack Message - if: ${{ success() }} - env: - SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} - RUN_ID: ${{ github.run_id }} - run: python scripts/slack_notifications.py candidate success - - name: Failed Release Candidate Slack Message - if: ${{ failure() }} - env: - SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} - RUN_ID: ${{ github.run_id }} - run: python scripts/slack_notifications.py candidate failure diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 86ccef5ec213..ca1c4055c01c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -90,33 +90,22 @@ jobs: run: | pip install requests echo "GH_PR_BRANCH=$(python scripts/get_release_branch.py)" >> $GITHUB_ENV - - name: Ensure that version tag matches branch version + - name: Ensure release branch corresponding to this tag exists env: GH_PR_BRANCH: ${{ env.GH_PR_BRANCH }} run: | BRANCH_VERSION=$(echo "$GH_PR_BRANCH" | sed 's/release\///' ) - if [ "$BRANCH_VERSION" != "$GIT_TAG" ] then - echo "ERROR: Version number from tag does not match the version number from the branch name." + echo "ERROR: release branch corresponding to this tag does not exist." exit 1 fi - - name: Checkout head of branch - env: - GH_PR_BRANCH: ${{ env.GH_PR_BRANCH }} - run: | - git pull origin "$GH_PR_BRANCH" --ff-only - name: Setup virtual env uses: ./.github/actions/make_init - name: Set release version from tag name env: GIT_TAG: ${{ env.GIT_TAG }} run: echo "STREAMLIT_RELEASE_VERSION=$GIT_TAG" >> $GITHUB_ENV - - name: Update version - env: - STREAMLIT_RELEASE_VERSION: ${{ env.STREAMLIT_RELEASE_VERSION }} - run: | - python scripts/update_version.py "$STREAMLIT_RELEASE_VERSION" - name: Create Package timeout-minutes: 120 run: | @@ -133,17 +122,6 @@ jobs: TWINE_PASSWORD: ${{ secrets.STREAMLIT_PYPI_API_TOKEN }} run: | make distribute - - name: Commit version updates - env: - GH_PR_BRANCH: ${{ env.GH_PR_BRANCH }} - STREAMLIT_RELEASE_VERSION: ${{ env.STREAMLIT_RELEASE_VERSION }} - run: | - git config user.email "core+streamlitbot-github@streamlit.io" - git config user.name "Streamlit Bot" - - git switch -c "$GH_PR_BRANCH" - - git commit -am 'Up version to "$STREAMLIT_RELEASE_VERSION"' && git push origin "$GH_PR_BRANCH" || echo "No changes to commit" - name: Create GitHub Release env: GIT_TAG: ${{ env.GIT_TAG }} diff --git a/scripts/get_latest_release_candidate.py b/scripts/get_latest_release_candidate.py deleted file mode 100644 index 64d020335669..000000000000 --- a/scripts/get_latest_release_candidate.py +++ /dev/null @@ -1,53 +0,0 @@ -#!/usr/bin/env python - -# Copyright (c) Streamlit Inc. (2018-2022) Snowflake Inc. (2022) -# -# 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. - -""" Checks for the latest release candidate for the current version. - -Gets all releases from PyPI, filters for release candidates of the current streamlit version. -If there is an existing RC, prints that RC version. If there is no RC, returns None. -""" -import os - -import requests - - -def check_last_rc(): - """Checks PyPI for existing release candidates""" - - current_version = os.getenv("DESIRED_VERSION") - - url = "https://pypi.org/pypi/streamlit/json" - response = requests.get(url).json() - all_releases = response["releases"].keys() - - current_version_candidates = sorted( - [x for x in all_releases if "rc" in x and current_version in x] - ) - - if current_version_candidates: - latest_release_candidate = current_version_candidates[-1] - return latest_release_candidate - else: - return None - - -def main(): - - print(check_last_rc()) - - -if __name__ == "__main__": - main() diff --git a/scripts/get_prerelease_version.py b/scripts/get_prerelease_version.py deleted file mode 100644 index 431fda2a6f3c..000000000000 --- a/scripts/get_prerelease_version.py +++ /dev/null @@ -1,92 +0,0 @@ -#!/usr/bin/env python -# Copyright (c) Streamlit Inc. (2018-2022) Snowflake Inc. (2022) -# -# 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. - -"""Calculate the next pre-release semver based on the target version and store in a version file. - -This has a small hack to get the pipeline on CircleCI to work properly. The command may run -multiple times, so this file is idempotent for each release build. To accomplish this, we store the -version into a file on the first run. Any subsequent calls will return the file contents if the file -exists instead of recalculating the release version. - -- If a version exists in the version file, return the file contents. -- If the current version is the same as the target version, increment the pre-release only -- If the current version is less than the target version, first update the version to match, then -increment the pre-release version - -A few examples: - -- Target: 1.6.0 - Current: 1.5.1 - Output: 1.6.0-rc1 - -- Target: 1.6.0 - Current: 1.6.0-rc1 - Output: 1.6.0-rc2 -""" - -import fileinput -import os -import re -import sys - -import semver - -BASE_DIR = os.path.abspath(os.path.join(os.path.dirname(__file__), "..")) -VERSION_FILE = ".prerelease-version" - - -def get_current_version(): - """Retrieve the current version by searching for a matching regex ('VERSION=') in setup.py""" - filename = os.path.join(BASE_DIR, "lib/setup.py") - regex = r"(?P
.*VERSION = \")(.*)(?P\"  # PEP-440$)"
-    pattern = re.compile(regex)
-
-    for line in fileinput.input(filename):
-        match = pattern.match(line.rstrip())
-        if match:
-            return match.groups()[1]
-
-    raise Exception('Did not find regex "%s" for version in setup.py' % (regex))
-
-
-def main():
-    if os.path.exists(VERSION_FILE):
-        with open(VERSION_FILE) as f:
-            print(f.read())
-            return
-
-    if len(sys.argv) != 2:
-        raise Exception(
-            'Specify target version as an argument: "%s 1.2.3"' % sys.argv[0]
-        )
-
-    target_version = semver.VersionInfo.parse(sys.argv[1])
-    # Ensure that current version is semver-compliant (it's stored as PEP440-compliant in setup.py)
-    current_version = semver.VersionInfo.parse(
-        get_current_version().replace("rc", "-rc.")
-    )
-
-    if current_version.finalize_version() < target_version:
-        current_version = target_version
-
-    new_version = str(current_version.bump_prerelease())
-    with open(VERSION_FILE, "w") as f:
-        f.write(new_version)
-
-    print(new_version)
-
-
-if __name__ == "__main__":
-    main()