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 ad1a8fc
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 19 deletions.
28 changes: 16 additions & 12 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 All @@ -112,31 +116,31 @@ 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 }}
run: |
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
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 ad1a8fc

Please sign in to comment.