From ca76538c4e5d940f64cdc929425633564c32e58a Mon Sep 17 00:00:00 2001 From: Joao Andre Date: Wed, 3 Apr 2024 21:41:47 -0300 Subject: [PATCH] fix: whitespace in variable name --- .../build-and-release-single-package.yml | 18 +++++++++++------- tools/release/fetch_latest_versions.py | 15 ++++++++------- 2 files changed, 19 insertions(+), 14 deletions(-) diff --git a/.github/workflows/build-and-release-single-package.yml b/.github/workflows/build-and-release-single-package.yml index cdde1e8acf..71f2d08c04 100644 --- a/.github/workflows/build-and-release-single-package.yml +++ b/.github/workflows/build-and-release-single-package.yml @@ -39,7 +39,11 @@ jobs: - name: Setup Version id: version-setup run: | - python tools/release/fetch_latest_versions.py ${{ github.event.inputs.release_type }} ${{ github.event.inputs.internal_dep_on_pypi }} ${{ github.event.inputs.target_version }} >> $GITHUB_OUTPUT + python tools/release/fetch_latest_versions.py \ + ${{ github.event.inputs.release_type }} \ + ${{ github.event.inputs.internal_dep_on_pypi }} \ + ${{ github.event.inputs.target_version }} \ + ${{ github.event.inputs.target_package }} >> $GITHUB_OUTPUT build-and-release-package: needs: [fetch-versions] @@ -64,27 +68,27 @@ jobs: - name: Set Build Variables id: set-variables run: | - if [ " ${{ github.event.inputs.target_package }}" == "config" ]; then + if [ "${{ github.event.inputs.target_package }}" == "config" ]; then echo "package_version=${{needs.fetch-versions.outputs.config_VERSION}}" >> $GITHUB_OUTPUT echo "package_dir=./taipy/config" >> $GITHUB_OUTPUT echo "release_name=${{needs.fetch-versions.outputs.config_VERSION}}-config" >> $GITHUB_OUTPUT echo "tar_path=./dist/${{ github.event.repository.name }}-config-${{needs.fetch-versions.outputs.config_VERSION}}.tar.gz" >> $GITHUB_OUTPUT - elif [ " ${{ github.event.inputs.target_package }}" == "core" ]; then + elif [ "${{ github.event.inputs.target_package }}" == "core" ]; then echo "package_version=${{needs.fetch-versions.outputs.core_VERSION}}" >> $GITHUB_OUTPUT echo "package_dir=./taipy/core" >> $GITHUB_OUTPUT echo "release_name=${{needs.fetch-versions.outputs.core_VERSION}}-core" >> $GITHUB_OUTPUT echo "tar_path=./dist/${{ github.event.repository.name }}-core-${{needs.fetch-versions.outputs.core_VERSION}}.tar.gz" >> $GITHUB_OUTPUT - elif [ " ${{ github.event.inputs.target_package }}" == "gui" ]; then + elif [ "${{ github.event.inputs.target_package }}" == "gui" ]; then echo "package_version=${{needs.fetch-versions.outputs.gui_VERSION}}" >> $GITHUB_OUTPUT echo "package_dir=./taipy/gui" >> $GITHUB_OUTPUT echo "release_name=${{needs.fetch-versions.outputs.gui_VERSION}}-gui" >> $GITHUB_OUTPUT echo "tar_path=./dist/${{ github.event.repository.name }}-gui-${{needs.fetch-versions.outputs.gui_VERSION}}.tar.gz" >> $GITHUB_OUTPUT - elif [ " ${{ github.event.inputs.target_package }}" == "rest" ]; then + elif [ "${{ github.event.inputs.target_package }}" == "rest" ]; then echo "package_version=${{needs.fetch-versions.outputs.rest_VERSION}}" >> $GITHUB_OUTPUT echo "package_dir=./taipy/rest" >> $GITHUB_OUTPUT echo "release_name=${{needs.fetch-versions.outputs.rest_VERSION}}-rest" >> $GITHUB_OUTPUT echo "tar_path=./dist/${{ github.event.repository.name }}-rest-${{needs.fetch-versions.outputs.rest_VERSION}}.tar.gz" >> $GITHUB_OUTPUT - elif [ " ${{ github.event.inputs.target_package }}" == "templates" ]; then + elif [ "${{ github.event.inputs.target_package }}" == "templates" ]; then echo "package_version=${{needs.fetch-versions.outputs.templates_VERSION}}" >> $GITHUB_OUTPUT echo "package_dir=./taipy/templates" >> $GITHUB_OUTPUT echo "release_name=${{needs.fetch-versions.outputs.templates_VERSION}}-templates" >> $GITHUB_OUTPUT @@ -94,7 +98,7 @@ jobs: - name: Update setup.requirements.txt run: | - python tools/release/update_setup_requirements.py taipy- ${{ github.event.inputs.target_package }} \ + python tools/release/update_setup_requirements.py taipy-${{ github.event.inputs.target_package }} \ ${{needs.fetch-versions.outputs.config_VERSION}} \ ${{needs.fetch-versions.outputs.core_VERSION}} \ ${{needs.fetch-versions.outputs.gui_VERSION}} \ diff --git a/tools/release/fetch_latest_versions.py b/tools/release/fetch_latest_versions.py index de1171b6f0..3e595fcc9a 100644 --- a/tools/release/fetch_latest_versions.py +++ b/tools/release/fetch_latest_versions.py @@ -11,10 +11,10 @@ import sys -import requests +import requests # type: ignore -def fetch_latest_releases_from_github(dev=False): +def fetch_latest_releases_from_github(dev=False, target_version="", target_package=""): releases = {} url = "https://api.github.com/repos/Avaiga/taipy/releases" response = requests.get(url) @@ -35,11 +35,11 @@ def fetch_latest_releases_from_github(dev=False): releases["rest"] = releases.get("rest") or tag.split("-")[0] elif "templates" in tag: releases["templates"] = releases.get("templates") or tag.split("-")[0] - + releases[target_package] = target_version return releases -def fetch_latest_releases_from_pypi(dev=False): +def fetch_latest_releases_from_pypi(dev=False, target_version="", target_package=""): releases = {} for pkg in ["config", "core", "gui", "rest", "templates"]: @@ -54,7 +54,7 @@ def fetch_latest_releases_from_pypi(dev=False): continue releases[pkg] = ver break - + releases[target_package] = target_version return releases @@ -62,6 +62,7 @@ def fetch_latest_releases_from_pypi(dev=False): is_dev_version = sys.argv[1] == "dev" is_pypi = sys.argv[2] == "true" target_version = sys.argv[3] + target_package = sys.argv[4] if is_dev_version and ".dev" not in target_version: raise Exception("Version does not contain suffix .dev") @@ -69,9 +70,9 @@ def fetch_latest_releases_from_pypi(dev=False): versions = {} if not is_pypi: - versions = fetch_latest_releases_from_github(is_dev_version) + versions = fetch_latest_releases_from_github(is_dev_version, target_version, target_package) else: - versions = fetch_latest_releases_from_pypi(is_dev_version) + versions = fetch_latest_releases_from_pypi(is_dev_version, target_version, target_package) for name, version in versions.items(): print(f"{name}_VERSION={version}") # noqa: T201