Build a dev version for all packages and release them #53
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build a dev version for all packages and release them | |
on: | |
workflow_dispatch: | |
inputs: | |
publish_on_pypi: | |
description: "Should the packages be published on Pypi?" | |
default: "false" | |
required: true | |
jobs: | |
fetch-versions: | |
runs-on: ubuntu-latest | |
outputs: | |
config_VERSION: ${{ steps.version-setup.outputs.config_VERSION }} | |
core_VERSION: ${{ steps.version-setup.outputs.core_VERSION }} | |
gui_VERSION: ${{ steps.version-setup.outputs.gui_VERSION }} | |
rest_VERSION: ${{ steps.version-setup.outputs.rest_VERSION }} | |
templates_VERSION: ${{ steps.version-setup.outputs.templates_VERSION }} | |
VERSION: ${{ steps.version-setup.outputs.VERSION }} | |
NEW_VERSION: ${{ steps.version-setup.outputs.NEW_VERSION }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup Dev Version | |
id: version-setup | |
run: | | |
python tools/release/setup_version.py ALL dev >> $GITHUB_OUTPUT | |
build-and-release-taipy-dev-packages: | |
needs: [fetch-versions] | |
timeout-minutes: 20 | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
package: [config, core, gui, rest, templates] | |
max-parallel: 1 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ssh-key: ${{secrets.DEPLOY_KEY}} | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: 3.9 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: '20' | |
- name: Extract commit hash | |
shell: bash | |
run: echo "HASH=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT | |
id: extract_hash | |
- name: Set Build Variables | |
id: set-variables | |
run: | | |
if [ "${{ matrix.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 [ "${{ matrix.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 [ "${{ matrix.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 [ "${{ matrix.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 [ "${{ matrix.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 | |
echo "tar_path=./dist/${{ github.event.repository.name }}-templates-${{needs.fetch-versions.outputs.templates_VERSION}}.tar.gz" >> $GITHUB_OUTPUT | |
fi | |
shell: bash | |
- name: Update setup.requirements.txt | |
run: | | |
python tools/release/update_setup_requirements.py taipy-${{ matrix.package }} \ | |
${{needs.fetch-versions.outputs.config_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.publish_on_pypi }} | |
- name: Copy tools | |
run: | | |
cp -r tools ${{ steps.set-variables.outputs.package_dir }} | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install build wheel | |
- name: Build package | |
working-directory: ${{ steps.set-variables.outputs.package_dir }} | |
run: | | |
python setup.py build_py && python -m build | |
- name: Create tag and release | |
working-directory: ${{ steps.set-variables.outputs.package_dir }} | |
run: | | |
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 "Release Draft ${{ steps.set-variables.outputs.release_name }}" | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Install Package | |
working-directory: ${{ steps.set-variables.outputs.package_dir }} | |
run: | | |
pip install ${{ steps.set-variables.outputs.tar_path }} | |
- name: Publish to PyPI | |
if: github.event.inputs.publish_on_pypi == 'true' | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
build-and-release-taipy-dev: | |
runs-on: ubuntu-latest | |
needs: [ build-and-release-taipy-dev-packages, fetch-versions ] | |
timeout-minutes: 20 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ssh-key: ${{secrets.DEPLOY_KEY}} | |
- name: Extract commit hash | |
shell: bash | |
run: echo "HASH=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT | |
id: extract_hash | |
- name: Set Build Variables | |
id: set-variables | |
run: | | |
echo "package_version=${{needs.fetch-versions.outputs.VERSION}}" >> $GITHUB_OUTPUT | |
echo "release_name=${{needs.fetch-versions.outputs.VERSION}}" >> $GITHUB_OUTPUT | |
echo "tar_path=./dist/${{ github.event.repository.name }}-${{needs.fetch-versions.outputs.VERSION}}.tar.gz" >> $GITHUB_OUTPUT | |
- name: Update setup.requirements.txt | |
run: | | |
python tools/release/update_setup_requirements.py taipy \ | |
${{needs.fetch-versions.outputs.config_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.publish_on_pypi }} | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install build wheel | |
- name: Build Taipy package | |
run: python setup.py build_py && python -m build | |
- name: Create tag and release Taipy | |
run: | | |
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 "Release Draft ${{ steps.set-variables.outputs.release_name }}" | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Install Taipy | |
run: | | |
pip install ${{ steps.set-variables.outputs.tar_path }} | |
- name: Check Taipy Installation | |
run: | | |
python tools/validate_taipy_install.py | |
- name: Publish to PyPI | |
if: github.event.inputs.publish_on_pypi == 'true' | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
- name: Download packages | |
run: | | |
gh release download ${{ needs.fetch-versions.outputs.config_VERSION }}-config --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 | |
run: | | |
find dist -type f -print0 | xargs -r0 gh release upload ${{ needs.fetch-versions.outputs.VERSION }} --clobber | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- uses: stefanzweifel/git-auto-commit-action@v4 | |
with: | |
file_pattern: '*/version.json' | |
commit_message: Update version to ${{ needs.fetch-versions.outputs.NEW_VERSION }} | |
- name: Reset changes | |
run: | | |
git reset --hard HEAD | |
git clean -fdx |