Build All Platforms #740
This file contains hidden or 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 All Platforms | |
| on: | |
| schedule: | |
| - cron: '30 20 * * *' # Runs at 12:30 AM every day; adjust as necessary | |
| workflow_dispatch: | |
| inputs: | |
| tag: | |
| description: 'Blender Version Tag (e.g., v4.0.1)' | |
| required: false | |
| jobs: | |
| check-version: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| new_tag: ${{ steps.check.outputs.new_tag }} | |
| new_commit: ${{ steps.check.outputs.new_commit }} | |
| tag_input: ${{ steps.set_tag_input.outputs.tag_input }} | |
| python_version: ${{ steps.set_python_version.outputs.python_version }} | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Check latest tag and commit | |
| id: check | |
| if: ${{ github.event.inputs.tag == '' }} | |
| run: cd workspace && python check_latest.py | |
| - name: Set tag input | |
| id: set_tag_input | |
| run: | | |
| if [[ "${{ github.event.inputs.tag }}" != '' ]]; then | |
| echo "tag_input=${{ github.event.inputs.tag }}" >> $GITHUB_OUTPUT | |
| echo "Building for ${{ github.event.inputs.tag }}" | |
| elif [[ "${{ steps.check.outputs.new_tag }}" == 'true' ]]; then | |
| echo "tag_input=${{ steps.check.outputs.latest_tag }}" >> $GITHUB_OUTPUT | |
| echo "Building for ${{ steps.check.outputs.latest_tag }}" | |
| # elif [[ "${{ steps.check.outputs.new_commit }}" == 'true' ]]; then | |
| # echo "tag_input=main" >> $GITHUB_OUTPUT | |
| # echo "Building for main" | |
| fi | |
| - name: Set Python version | |
| id: set_python_version | |
| run: | | |
| TAG="${{ steps.set_tag_input.outputs.tag_input }}" | |
| VERSION="${TAG#v}" | |
| MAJOR="${VERSION%%.*}" | |
| REMAINDER="${VERSION#*.}" | |
| MINOR="${REMAINDER%%.*}" | |
| if [[ "$MAJOR" -lt 4 ]] || ([[ "$MAJOR" -eq 4 ]] && [[ "$MINOR" -lt 1 ]]); then | |
| echo "python_version=3.10.11" >> $GITHUB_OUTPUT | |
| echo "Building for Python 3.10.11" | |
| elif [[ "$MAJOR" -gt 5 ]] || ([[ "$MAJOR" -eq 5 ]] && [[ "$MINOR" -ge 1 ]]); then | |
| echo "python_version=3.13.11" >> $GITHUB_OUTPUT | |
| echo "Building for Python 3.13.11" | |
| else | |
| echo "python_version=3.11.9" >> $GITHUB_OUTPUT | |
| echo "Building for Python 3.11.9" | |
| fi | |
| # - name: Build for Windows | |
| # if: ${{ steps.check.outputs.new_tag == 'true' || steps.check.outputs.new_commit == 'true' }} | |
| # uses: ./.github/actions/build_windows@main | |
| # with: | |
| # tag: ${{ steps.check.outputs.tag_input }} | |
| # python_version: ${{ steps.check.outputs.python_version }} | |
| # build-stubs: | |
| # needs: check-version | |
| # if: ${{ needs.check-version.outputs.tag_input != '' }} | |
| # uses: ./.github/workflows/generate_stubs.yml | |
| # with: | |
| # tag: ${{ needs.check-version.outputs.tag_input }} | |
| # python_version: ${{ needs.check-version.outputs.python_version }} | |
| # permissions: | |
| # contents: write | |
| build-for-windows: | |
| needs: [check-version] | |
| if: ${{ needs.check-version.outputs.tag_input != '' }} | |
| uses: ./.github/workflows/build_windows.yml | |
| with: | |
| tag: ${{ needs.check-version.outputs.tag_input }} | |
| python_version: ${{ needs.check-version.outputs.python_version }} | |
| permissions: | |
| contents: write | |
| build-for-linux: | |
| needs: [check-version] | |
| if: ${{ needs.check-version.outputs.tag_input != '' }} | |
| uses: ./.github/workflows/build_linux.yml | |
| with: | |
| tag: ${{ needs.check-version.outputs.tag_input }} | |
| python_version: ${{ needs.check-version.outputs.python_version }} | |
| permissions: | |
| contents: write | |
| build-for-macos: | |
| needs: [check-version] | |
| if: ${{ needs.check-version.outputs.tag_input != '' }} | |
| uses: ./.github/workflows/build_macos.yml | |
| with: | |
| tag: ${{ needs.check-version.outputs.tag_input }} | |
| python_version: ${{ needs.check-version.outputs.python_version }} | |
| permissions: | |
| contents: write | |
| update-versions: | |
| runs-on: ubuntu-latest | |
| needs: [ check-version, build-for-windows, build-for-linux, build-for-macos] | |
| if: ${{ needs.check-version.outputs.new_tag == 'true' || needs.check-version.outputs.new_commit == 'true' }} | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Update versions | |
| run: cd workspace && python check_latest.py | |
| - name: Commit and push changes | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| uses: EndBug/add-and-commit@v7 | |
| with: | |
| default_author: github_actions | |
| message: 'Update version info with latest tag and commit' | |
| add: 'workspace/version_info.json' | |
| update-repository-index: | |
| needs: [update-versions] | |
| if: ${{ needs.update-versions.result == 'success' }} | |
| uses: ./.github/workflows/update_repository.yml | |
| permissions: | |
| contents: write | |