From 0df7d00140f1c27b06744d5ccf82bcb41b99d069 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Andr=C3=A9?= <88906996+joaoandre-avaiga@users.noreply.github.com> Date: Mon, 8 Apr 2024 06:29:31 -0300 Subject: [PATCH] fix: whitespace in variable name (#1101) --- .../build-and-release-single-package.yml | 28 +++++++++++-------- .github/workflows/publish-single-package.yml | 2 +- tools/release/fetch_latest_versions.py | 15 +++++----- 3 files changed, 25 insertions(+), 20 deletions(-) diff --git a/.github/workflows/build-and-release-single-package.yml b/.github/workflows/build-and-release-single-package.yml index cdde1e8acf..919a7db7f7 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}} \ @@ -112,23 +116,23 @@ jobs: pip install build wheel pipenv mypy black isort - name: Install GUI dependencies - if: matrix.package == 'gui' + if: github.event.inputs.target_package == 'gui' run: | pipenv install --dev - name: Generate GUI pyi file - if: matrix.package == 'gui' + if: github.event.inputs.target_package == 'gui' run: | cp tools/gui/generate_pyi.py pyi_temp.py && pipenv run python pyi_temp.py && rm pyi_temp.py - name: Build frontends - if: matrix.package == 'gui' + if: github.event.inputs.target_package == 'gui' run: | python tools/frontend/bundle_build.py - name: Copy files from tools run: | - cp -r tools/packages/taipy-${{matrix.package}}/. ${{ steps.set-variables.outputs.package_dir }} + cp -r tools/packages/taipy-${{ github.event.inputs.target_package }}/. ${{ steps.set-variables.outputs.package_dir }} - name: Build Package Structure working-directory: ${{ steps.set-variables.outputs.package_dir }} @@ -136,7 +140,7 @@ jobs: python tools/release/build_package_structure.py ${{ github.event.inputs.target_package }} - name: Copy Taipy Logger - if: matrix.package == 'config' + if: github.event.inputs.target_package == 'config' run: | cp -r taipy/logger/. ${{ steps.set-variables.outputs.package_dir }}/taipy/logger diff --git a/.github/workflows/publish-single-package.yml b/.github/workflows/publish-single-package.yml index d46c50aab1..b8dbc703ad 100644 --- a/.github/workflows/publish-single-package.yml +++ b/.github/workflows/publish-single-package.yml @@ -36,7 +36,7 @@ jobs: - name: Download assets from tag if: steps.check-version.outputs.exists == 'false' run: | - gh release download ${{ github.event.inputs.version }}-${{ github.event.inputs.target_package }}} --dir dist + gh release download ${{ github.event.inputs.version }}-${{ github.event.inputs.target_package }} --dir dist env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 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