Skip to content

Commit

Permalink
fix: whitespace in variable name
Browse files Browse the repository at this point in the history
  • Loading branch information
joaoandre-avaiga committed Apr 4, 2024
1 parent 260b420 commit ca76538
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 14 deletions.
18 changes: 11 additions & 7 deletions .github/workflows/build-and-release-single-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand All @@ -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
Expand All @@ -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}} \
Expand Down
15 changes: 8 additions & 7 deletions tools/release/fetch_latest_versions.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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"]:
Expand All @@ -54,24 +54,25 @@ def fetch_latest_releases_from_pypi(dev=False):
continue
releases[pkg] = ver
break

releases[target_package] = target_version
return releases


if __name__ == "__main__":
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")

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

0 comments on commit ca76538

Please sign in to comment.