123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274 |
- name: Build all taipy packages and release them
- on:
- workflow_dispatch:
- inputs:
- target_version:
- description: "Package version"
- required: true
- release_type:
- description: "Release type"
- required: true
- type: choice
- options:
- - dev
- - production
- default: "dev"
- sub_packages_location:
- description: "Dependencies location"
- required: true
- type: choice
- options:
- - GitHub
- - Pypi
- default: "GitHub"
- env:
- NODE_OPTIONS: --max-old-space-size=4096
- permissions:
- contents: write
- jobs:
- fetch-versions:
- runs-on: ubuntu-latest
- outputs:
- common_VERSION: ${{ steps.version-setup.outputs.common_VERSION }}
- NEXT_common_VERSION: ${{ steps.version-setup.outputs.NEXT_common_VERSION }}
- core_VERSION: ${{ steps.version-setup.outputs.core_VERSION }}
- NEXT_core_VERSION: ${{ steps.version-setup.outputs.NEXT_core_VERSION }}
- gui_VERSION: ${{ steps.version-setup.outputs.gui_VERSION }}
- NEXT_gui_VERSION: ${{ steps.version-setup.outputs.NEXT_gui_VERSION }}
- rest_VERSION: ${{ steps.version-setup.outputs.rest_VERSION }}
- NEXT_rest_VERSION: ${{ steps.version-setup.outputs.NEXT_rest_VERSION }}
- templates_VERSION: ${{ steps.version-setup.outputs.templates_VERSION }}
- NEXT_templates_VERSION: ${{ steps.version-setup.outputs.NEXT_templates_VERSION }}
- taipy_VERSION: ${{ steps.version-setup.outputs.taipy_VERSION }}
- NEXT_taipy_VERSION: ${{ steps.version-setup.outputs.NEXT_taipy_VERSION }}
- LATEST_TAIPY_VERSION: ${{ steps.version-setup.outputs.LATEST_TAIPY_VERSION }}
- BRANCH_NAME: ${{ steps.extract_branch.outputs.branch }}
- steps:
- - uses: actions/checkout@v4
- - name: Extract branch name
- id: extract_branch
- shell: bash
- run: echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT
- - name: Install mandatory Python packages
- run: |
- python -m pip install --upgrade pip
- pip install requests
- - name: Setup Version
- id: version-setup
- run: |
- python tools/release/setup_version.py ALL ${{ github.event.inputs.release_type }} \
- ${{ github.event.inputs.target_version }} \
- ${{ steps.extract_branch.outputs.branch }} >> $GITHUB_OUTPUT
- build-and-release-taipy-packages:
- needs: [fetch-versions]
- runs-on: ubuntu-latest
- timeout-minutes: 20
- strategy:
- matrix:
- package: [common, core, gui, rest, templates]
- max-parallel: 1
- steps:
- - uses: actions/checkout@v4
- with:
- ssh-key: ${{ secrets.DEPLOY_KEY }}
- - uses: actions/setup-python@v5
- with:
- python-version: 3.9
- - uses: actions/setup-node@v4
- with:
- node-version: '20'
- - name: Extract commit hash
- id: extract_hash
- shell: bash
- run: echo "HASH=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
- - name: Install mandatory Python packages
- run: |
- python -m pip install --upgrade pip
- pip install requests
- - name: Set Build Variables
- id: set-variables
- shell: bash
- run: |
- if [ "${{ matrix.package }}" == "common" ]; then
- echo "package_version=${{ needs.fetch-versions.outputs.common_VERSION }}" >> $GITHUB_OUTPUT
- echo "release_name=${{ needs.fetch-versions.outputs.common_VERSION }}-common" >> $GITHUB_OUTPUT
- echo "tar_path=./dist/${{ github.event.repository.name }}-common-${{ needs.fetch-versions.outputs.common_VERSION }}.tar.gz" >> $GITHUB_OUTPUT
- elif [ "${{ matrix.package }}" == "core" ]; then
- echo "package_version=${{ needs.fetch-versions.outputs.core_VERSION }}" >> $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 [ "${{ matrix.package }}" == "gui" ]; then
- echo "package_version=${{needs.fetch-versions.outputs.gui_VERSION}}" >> $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 [ "${{ matrix.package }}" == "rest" ]; then
- echo "package_version=${{ needs.fetch-versions.outputs.rest_VERSION }}" >> $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 [ "${{ matrix.package }}" == "templates" ]; then
- echo "package_version=${{ needs.fetch-versions.outputs.templates_VERSION }}" >> $GITHUB_OUTPUT
- echo "release_name=${{ needs.fetch-versions.outputs.templates_VERSION }}-templates" >> $GITHUB_OUTPUT
- echo "tar_path=./dist/${{ github.event.repository.name }}-templates-${{ needs.fetch-versions.outputs.templates_VERSION }}.tar.gz" >> $GITHUB_OUTPUT
- fi
- - name: Update setup.requirements.txt
- run: |
- python tools/release/update_setup_requirements.py ${{ matrix.package }} \
- ${{ needs.fetch-versions.outputs.common_VERSION }} \
- ${{ needs.fetch-versions.outputs.core_VERSION }} \
- ${{ needs.fetch-versions.outputs.gui_VERSION }} \
- ${{ needs.fetch-versions.outputs.rest_VERSION }} \
- ${{ needs.fetch-versions.outputs.templates_VERSION }} \
- ${{ github.event.inputs.sub_packages_location }} \
- ${{ github.repository }}
- - name: Install dependencies
- run: |
- python -m pip install --upgrade pip
- pip install build wheel pipenv mypy black isort
- - name: Build GUI front-end
- if: matrix.package == 'gui'
- run: |
- pipenv install --dev
- pipenv run python tools/gui/generate_pyi.py
- python tools/frontend/bundle_build.py gui
- - name: Archive the GUI front-end
- if: matrix.package == 'gui'
- run: |
- tar -czf gui-frontend.tar.gz taipy/gui/webapp
- - name: Upload front-end archive as an artifact
- if: matrix.package == 'gui'
- uses: actions/upload-artifact@v4
- with:
- name: gui-frontend
- path: gui-frontend.tar.gz
- - name: Build Package Structure
- run: |
- python tools/release/build_package_structure.py ${{ matrix.package }}
- - name: Build package
- working-directory: "build_${{ matrix.package }}"
- run: |
- python -m build
- for file in ./dist/*; do mv "$file" "${file//_/-}"; done
- - name: Create tag and release ${{ steps.set-variables.outputs.release_name }}
- working-directory: "build_${{ matrix.package }}"
- run: |
- if [ "${{ github.event.inputs.release_type }}" == "dev" ]; then
- gh release create ${{ steps.set-variables.outputs.release_name }} ${{ steps.set-variables.outputs.tar_path }} --target ${{ steps.extract_hash.outputs.HASH }} --prerelease --title ${{ steps.set-variables.outputs.release_name }} --notes "Dev Release ${{ steps.set-variables.outputs.release_name }}"
- else
- gh release create ${{ steps.set-variables.outputs.release_name }} ${{ steps.set-variables.outputs.tar_path }} --target ${{ steps.extract_hash.outputs.HASH }} --title ${{ steps.set-variables.outputs.release_name }} --notes "Release ${{ steps.set-variables.outputs.release_name }}"
- fi
- shell: bash
- env:
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- build-and-release-taipy:
- needs: [build-and-release-taipy-packages, fetch-versions]
- runs-on: ubuntu-latest
- timeout-minutes: 20
- steps:
- - uses: actions/checkout@v4
- - name: Extract commit hash
- id: extract_hash
- shell: bash
- run: echo "HASH=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
- - name: Set Build Variables
- id: set-variables
- shell: bash
- run: |
- echo "package_version=${{ needs.fetch-versions.outputs.taipy_VERSION }}" >> $GITHUB_OUTPUT
- echo "release_name=${{ needs.fetch-versions.outputs.taipy_VERSION }}" >> $GITHUB_OUTPUT
- echo "tar_path=./dist/${{ github.event.repository.name }}-${{ needs.fetch-versions.outputs.taipy_VERSION }}.tar.gz" >> $GITHUB_OUTPUT
- - name: Update setup.requirements.txt
- run: |
- python tools/release/update_setup_requirements.py taipy \
- ${{ needs.fetch-versions.outputs.common_VERSION }} \
- ${{ needs.fetch-versions.outputs.core_VERSION }} \
- ${{ needs.fetch-versions.outputs.gui_VERSION }} \
- ${{ needs.fetch-versions.outputs.rest_VERSION }} \
- ${{ needs.fetch-versions.outputs.templates_VERSION }} \
- ${{ github.event.inputs.sub_packages_location }} \
- ${{ github.repository }}
- - name: Install dependencies
- run: |
- python -m pip install --upgrade pip
- pip install build wheel
- - uses: actions/download-artifact@v4
- with:
- name: gui-frontend
- path: .
- - name: Retrieve the GUI front-end
- run: tar -xzf gui-frontend.tar.gz
- - name: Build taipy front-end
- run: |
- python tools/frontend/bundle_build.py taipy
- - name: Build taipy Package Structure
- run: |
- python tools/release/build_package_structure.py taipy
- - name: Build taipy package
- working-directory: "build_taipy"
- run: |
- python -m build
- - name: Create tag and release Taipy
- working-directory: "build_taipy"
- run: |
- if [ "${{ github.event.inputs.release_type }}" == "dev" ]; then
- gh release create ${{ steps.set-variables.outputs.release_name }} ${{ steps.set-variables.outputs.tar_path }} --target ${{ steps.extract_hash.outputs.HASH }} --prerelease --title ${{ steps.set-variables.outputs.release_name }} --notes "Dev Release ${{ steps.set-variables.outputs.release_name }}"
- else
- gh release create ${{ steps.set-variables.outputs.release_name }} ${{ steps.set-variables.outputs.tar_path }} --target ${{ steps.extract_hash.outputs.HASH }} --title ${{ steps.set-variables.outputs.release_name }} --notes "Release ${{ steps.set-variables.outputs.release_name }}"
- fi
- shell: bash
- env:
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- - name: Download packages
- working-directory: "build_taipy"
- run: |
- gh release download ${{ needs.fetch-versions.outputs.common_VERSION }}-common --skip-existing --dir dist
- gh release download ${{ needs.fetch-versions.outputs.core_VERSION }}-core --skip-existing --dir dist
- gh release download ${{ needs.fetch-versions.outputs.gui_VERSION }}-gui --skip-existing --dir dist
- gh release download ${{ needs.fetch-versions.outputs.rest_VERSION }}-rest --skip-existing --dir dist
- gh release download ${{ needs.fetch-versions.outputs.templates_VERSION }}-templates --skip-existing --dir dist
- env:
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- - name: Bundle all packages in main release tag
- working-directory: "build_taipy"
- run: |
- find dist -type f -print0 | xargs -r0 gh release upload ${{ needs.fetch-versions.outputs.taipy_VERSION }} --clobber
- env:
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- - name: Ensure the latest 'taipy' production release is marked as *latest*
- if: github.event.inputs.release_type == 'dev'
- run: |
- gh release edit ${{ needs.fetch-versions.outputs.LATEST_TAIPY_VERSION }} --latest
- shell: bash
- env:
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|