build-and-release-dev.yml 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204
  1. name: Build a dev version for all packages and release them
  2. on:
  3. workflow_dispatch:
  4. inputs:
  5. publish_on_pypi:
  6. description: "Should the packages be published on Pypi?"
  7. default: "false"
  8. required: true
  9. jobs:
  10. fetch-versions:
  11. runs-on: ubuntu-latest
  12. outputs:
  13. config_VERSION: ${{ steps.version-setup.outputs.config_VERSION }}
  14. core_VERSION: ${{ steps.version-setup.outputs.core_VERSION }}
  15. gui_VERSION: ${{ steps.version-setup.outputs.gui_VERSION }}
  16. rest_VERSION: ${{ steps.version-setup.outputs.rest_VERSION }}
  17. templates_VERSION: ${{ steps.version-setup.outputs.templates_VERSION }}
  18. VERSION: ${{ steps.version-setup.outputs.VERSION }}
  19. NEW_VERSION: ${{ steps.version-setup.outputs.NEW_VERSION }}
  20. steps:
  21. - uses: actions/checkout@v4
  22. - name: Setup Dev Version
  23. id: version-setup
  24. run: |
  25. python tools/release/setup_version.py ALL dev >> $GITHUB_OUTPUT
  26. build-and-release-taipy-dev-packages:
  27. needs: [fetch-versions]
  28. timeout-minutes: 20
  29. runs-on: ubuntu-latest
  30. strategy:
  31. matrix:
  32. package: [config, core, gui, rest, templates]
  33. max-parallel: 1
  34. steps:
  35. - uses: actions/checkout@v4
  36. with:
  37. ssh-key: ${{secrets.DEPLOY_KEY}}
  38. - uses: actions/setup-python@v4
  39. with:
  40. python-version: 3.9
  41. - uses: actions/setup-node@v4
  42. with:
  43. node-version: '20'
  44. - name: Extract commit hash
  45. shell: bash
  46. run: echo "HASH=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
  47. id: extract_hash
  48. - name: Set Build Variables
  49. id: set-variables
  50. run: |
  51. if [ "${{ matrix.package }}" == "config" ]; then
  52. echo "package_version=${{needs.fetch-versions.outputs.config_VERSION}}" >> $GITHUB_OUTPUT
  53. echo "package_dir=./taipy/config" >> $GITHUB_OUTPUT
  54. echo "release_name=${{needs.fetch-versions.outputs.config_VERSION}}-config" >> $GITHUB_OUTPUT
  55. echo "tar_path=./dist/${{ github.event.repository.name }}-config-${{needs.fetch-versions.outputs.config_VERSION}}.tar.gz" >> $GITHUB_OUTPUT
  56. elif [ "${{ matrix.package }}" == "core" ]; then
  57. echo "package_version=${{needs.fetch-versions.outputs.core_VERSION}}" >> $GITHUB_OUTPUT
  58. echo "package_dir=./taipy/core" >> $GITHUB_OUTPUT
  59. echo "release_name=${{needs.fetch-versions.outputs.core_VERSION}}-core" >> $GITHUB_OUTPUT
  60. echo "tar_path=./dist/${{ github.event.repository.name }}-core-${{needs.fetch-versions.outputs.core_VERSION}}.tar.gz" >> $GITHUB_OUTPUT
  61. elif [ "${{ matrix.package }}" == "gui" ]; then
  62. echo "package_version=${{needs.fetch-versions.outputs.gui_VERSION}}" >> $GITHUB_OUTPUT
  63. echo "package_dir=./taipy/gui" >> $GITHUB_OUTPUT
  64. echo "release_name=${{needs.fetch-versions.outputs.gui_VERSION}}-gui" >> $GITHUB_OUTPUT
  65. echo "tar_path=./dist/${{ github.event.repository.name }}-gui-${{needs.fetch-versions.outputs.gui_VERSION}}.tar.gz" >> $GITHUB_OUTPUT
  66. elif [ "${{ matrix.package }}" == "rest" ]; then
  67. echo "package_version=${{needs.fetch-versions.outputs.rest_VERSION}}" >> $GITHUB_OUTPUT
  68. echo "package_dir=./taipy/rest" >> $GITHUB_OUTPUT
  69. echo "release_name=${{needs.fetch-versions.outputs.rest_VERSION}}-rest" >> $GITHUB_OUTPUT
  70. echo "tar_path=./dist/${{ github.event.repository.name }}-rest-${{needs.fetch-versions.outputs.rest_VERSION}}.tar.gz" >> $GITHUB_OUTPUT
  71. elif [ "${{ matrix.package }}" == "templates" ]; then
  72. echo "package_version=${{needs.fetch-versions.outputs.templates_VERSION}}" >> $GITHUB_OUTPUT
  73. echo "package_dir=./taipy/templates" >> $GITHUB_OUTPUT
  74. echo "release_name=${{needs.fetch-versions.outputs.templates_VERSION}}-templates" >> $GITHUB_OUTPUT
  75. echo "tar_path=./dist/${{ github.event.repository.name }}-templates-${{needs.fetch-versions.outputs.templates_VERSION}}.tar.gz" >> $GITHUB_OUTPUT
  76. fi
  77. shell: bash
  78. - name: Update setup.requirements.txt
  79. run: |
  80. python tools/release/update_setup_requirements.py taipy-${{ matrix.package }} \
  81. ${{needs.fetch-versions.outputs.config_VERSION}} \
  82. ${{needs.fetch-versions.outputs.core_VERSION}} \
  83. ${{needs.fetch-versions.outputs.gui_VERSION}} \
  84. ${{needs.fetch-versions.outputs.rest_VERSION}} \
  85. ${{needs.fetch-versions.outputs.templates_VERSION}} \
  86. ${{ github.event.inputs.publish_on_pypi }}
  87. - name: Copy tools
  88. run: |
  89. cp -r tools ${{ steps.set-variables.outputs.package_dir }}
  90. - name: Install dependencies
  91. run: |
  92. python -m pip install --upgrade pip
  93. pip install build wheel
  94. - name: Build package
  95. working-directory: ${{ steps.set-variables.outputs.package_dir }}
  96. run: |
  97. python setup.py build_py && python -m build
  98. - name: Create tag and release
  99. working-directory: ${{ steps.set-variables.outputs.package_dir }}
  100. run: |
  101. 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 }}"
  102. env:
  103. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  104. - name: Install Package
  105. working-directory: ${{ steps.set-variables.outputs.package_dir }}
  106. run: |
  107. pip install ${{ steps.set-variables.outputs.tar_path }}
  108. - name: Publish to PyPI
  109. if: github.event.inputs.publish_on_pypi == 'true'
  110. uses: pypa/gh-action-pypi-publish@release/v1
  111. build-and-release-taipy-dev:
  112. runs-on: ubuntu-latest
  113. needs: [ build-and-release-taipy-dev-packages, fetch-versions ]
  114. timeout-minutes: 20
  115. steps:
  116. - uses: actions/checkout@v4
  117. with:
  118. ssh-key: ${{secrets.DEPLOY_KEY}}
  119. - name: Extract commit hash
  120. shell: bash
  121. run: echo "HASH=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
  122. id: extract_hash
  123. - name: Set Build Variables
  124. id: set-variables
  125. run: |
  126. echo "package_version=${{needs.fetch-versions.outputs.VERSION}}" >> $GITHUB_OUTPUT
  127. echo "release_name=${{needs.fetch-versions.outputs.VERSION}}" >> $GITHUB_OUTPUT
  128. echo "tar_path=./dist/${{ github.event.repository.name }}-${{needs.fetch-versions.outputs.VERSION}}.tar.gz" >> $GITHUB_OUTPUT
  129. - name: Update setup.requirements.txt
  130. run: |
  131. python tools/release/update_setup_requirements.py taipy \
  132. ${{needs.fetch-versions.outputs.config_VERSION}} \
  133. ${{needs.fetch-versions.outputs.core_VERSION}} \
  134. ${{needs.fetch-versions.outputs.gui_VERSION}} \
  135. ${{needs.fetch-versions.outputs.rest_VERSION}} \
  136. ${{needs.fetch-versions.outputs.templates_VERSION}} \
  137. ${{ github.event.inputs.publish_on_pypi }}
  138. - name: Install dependencies
  139. run: |
  140. python -m pip install --upgrade pip
  141. pip install build wheel
  142. - name: Build Taipy package
  143. run: python setup.py build_py && python -m build
  144. - name: Create tag and release Taipy
  145. run: |
  146. 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 }}"
  147. env:
  148. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  149. - name: Install Taipy
  150. run: |
  151. pip install ${{ steps.set-variables.outputs.tar_path }}
  152. - name: Check Taipy Installation
  153. run: |
  154. python tools/validate_taipy_install.py
  155. - name: Publish to PyPI
  156. if: github.event.inputs.publish_on_pypi == 'true'
  157. uses: pypa/gh-action-pypi-publish@release/v1
  158. - name: Download packages
  159. run: |
  160. gh release download ${{ needs.fetch-versions.outputs.config_VERSION }}-config --skip-existing --dir dist
  161. gh release download ${{ needs.fetch-versions.outputs.core_VERSION }}-core --skip-existing --dir dist
  162. gh release download ${{ needs.fetch-versions.outputs.gui_VERSION }}-gui --skip-existing --dir dist
  163. gh release download ${{ needs.fetch-versions.outputs.rest_VERSION }}-rest --skip-existing --dir dist
  164. gh release download ${{ needs.fetch-versions.outputs.templates_VERSION }}-templates --skip-existing --dir dist
  165. env:
  166. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  167. - name: Bundle all packages in main release tag
  168. run: |
  169. find dist -type f -print0 | xargs -r0 gh release upload ${{ needs.fetch-versions.outputs.VERSION }} --clobber
  170. env:
  171. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  172. - uses: stefanzweifel/git-auto-commit-action@v4
  173. with:
  174. file_pattern: '*/version.json'
  175. commit_message: Update version to ${{ needs.fetch-versions.outputs.NEW_VERSION }}
  176. - name: Reset changes
  177. run: |
  178. git reset --hard HEAD
  179. git clean -fdx