Build Orchestrator #2
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 Orchestrator | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| version: | |
| description: 'Version (YY.MM.DD - leave empty for auto-generation)' | |
| required: false | |
| type: string | |
| default: '' | |
| custom_url: | |
| description: 'Custom App URL (optional - disables auto-update, version bump, draft)' | |
| required: false | |
| type: string | |
| default: '' | |
| build_macos: | |
| description: '🍎 macOS (x64 + ARM64)' | |
| required: true | |
| type: boolean | |
| default: true | |
| build_windows: | |
| description: '🪟 Windows (x64)' | |
| required: true | |
| type: boolean | |
| default: true | |
| build_linux: | |
| description: '🐧 Linux (AppImage)' | |
| required: true | |
| type: boolean | |
| default: true | |
| build_setapp: | |
| description: '📦 Setapp (Universal macOS)' | |
| required: true | |
| type: boolean | |
| default: true | |
| build_variant: | |
| description: 'Build variant (ignored if custom URL provided)' | |
| required: true | |
| type: choice | |
| options: | |
| - production | |
| - beta | |
| default: production | |
| jobs: | |
| prepare: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| version: ${{ steps.version.outputs.version }} | |
| version_tag: ${{ steps.version.outputs.tag }} | |
| should_bump_version: ${{ steps.logic.outputs.should_bump }} | |
| should_create_draft: ${{ steps.logic.outputs.should_draft }} | |
| build_variant: ${{ steps.logic.outputs.variant }} | |
| steps: | |
| - name: Generate or validate version | |
| id: version | |
| run: | | |
| if [ -z "${{ inputs.version }}" ]; then | |
| VERSION=$(date -u +'%y.%-m.%-d') | |
| echo "📅 Auto-generated: v$VERSION" | |
| else | |
| VERSION="${{ inputs.version }}" | |
| if [[ ! "$VERSION" =~ ^[0-9]{2}\.[0-9]{1,2}\.[0-9]{1,2}(-beta\.[0-9]+)?$ ]]; then | |
| echo "❌ Invalid version format" | |
| exit 1 | |
| fi | |
| echo "✅ Using: v$VERSION" | |
| fi | |
| echo "version=$VERSION" >> $GITHUB_OUTPUT | |
| echo "tag=v$VERSION" >> $GITHUB_OUTPUT | |
| - name: Determine workflow logic | |
| id: logic | |
| run: | | |
| SHOULD_BUMP="true" | |
| SHOULD_DRAFT="false" | |
| VARIANT="${{ inputs.build_variant }}" | |
| # Custom URL overrides | |
| if [ -n "${{ inputs.custom_url }}" ]; then | |
| echo "::notice title=Custom URL Mode::Auto-update disabled, version bump skipped, draft release skipped" | |
| SHOULD_BUMP="false" | |
| SHOULD_DRAFT="false" | |
| VARIANT="custom" | |
| # Verify only standard platforms selected | |
| if [ "${{ inputs.build_setapp }}" == "true" ]; then | |
| echo "::error title=Invalid Configuration::Setapp builds not allowed with custom URL" | |
| exit 1 | |
| fi | |
| fi | |
| # Draft release only for production + all platforms | |
| if [ "$VARIANT" == "production" ] && \ | |
| [ "${{ inputs.build_macos }}" == "true" ] && \ | |
| [ "${{ inputs.build_windows }}" == "true" ] && \ | |
| [ "${{ inputs.build_linux }}" == "true" ] && \ | |
| [ "${{ inputs.build_setapp }}" == "true" ]; then | |
| SHOULD_DRAFT="true" | |
| fi | |
| # Beta builds don't get draft releases | |
| if [ "$VARIANT" == "beta" ]; then | |
| SHOULD_DRAFT="false" | |
| fi | |
| echo "should_bump=$SHOULD_BUMP" >> $GITHUB_OUTPUT | |
| echo "should_draft=$SHOULD_DRAFT" >> $GITHUB_OUTPUT | |
| echo "variant=$VARIANT" >> $GITHUB_OUTPUT | |
| bump-version: | |
| needs: prepare | |
| if: needs.prepare.outputs.should_bump_version == 'true' | |
| uses: ./.github/workflows/bump-version.yml | |
| with: | |
| version: ${{ needs.prepare.outputs.version }} | |
| build-macos: | |
| needs: [prepare, bump-version] | |
| if: | | |
| always() && | |
| inputs.build_macos == true && | |
| (needs.bump-version.result == 'success' || needs.bump-version.result == 'skipped') | |
| uses: ./.github/workflows/release_desktop_app.yml | |
| secrets: inherit | |
| with: | |
| platform: macos-latest | |
| build_variant: ${{ needs.prepare.outputs.build_variant }} | |
| custom_url: ${{ inputs.custom_url }} | |
| git_ref: ${{ needs.bump-version.outputs.version_tag || github.ref }} | |
| build-windows: | |
| needs: [prepare, bump-version] | |
| if: | | |
| always() && | |
| inputs.build_windows == true && | |
| (needs.bump-version.result == 'success' || needs.bump-version.result == 'skipped') | |
| uses: ./.github/workflows/release_desktop_app.yml | |
| secrets: inherit | |
| with: | |
| platform: windows-latest | |
| build_variant: ${{ needs.prepare.outputs.build_variant }} | |
| custom_url: ${{ inputs.custom_url }} | |
| git_ref: ${{ needs.bump-version.outputs.version_tag || github.ref }} | |
| build-linux: | |
| needs: [prepare, bump-version] | |
| if: | | |
| always() && | |
| inputs.build_linux == true && | |
| (needs.bump-version.result == 'success' || needs.bump-version.result == 'skipped') | |
| uses: ./.github/workflows/release_desktop_app.yml | |
| secrets: inherit | |
| with: | |
| platform: ubuntu-latest | |
| build_variant: ${{ needs.prepare.outputs.build_variant }} | |
| custom_url: ${{ inputs.custom_url }} | |
| git_ref: ${{ needs.bump-version.outputs.version_tag || github.ref }} | |
| checkout_branch: '' # Use git_ref instead - will fall back to current branch | |
| build-setapp: | |
| needs: [prepare, bump-version] | |
| if: | | |
| always() && | |
| inputs.build_setapp == true && | |
| inputs.custom_url == '' && | |
| (needs.bump-version.result == 'success' || needs.bump-version.result == 'skipped') | |
| uses: ./.github/workflows/build-setapp.yml | |
| secrets: inherit | |
| with: | |
| git_ref: ${{ needs.bump-version.outputs.version_tag || github.ref }} # Use current branch instead of hardcoding | |
| create-draft: | |
| needs: [prepare, build-macos, build-windows, build-linux] | |
| if: | | |
| always() && | |
| needs.prepare.outputs.should_create_draft == 'true' && | |
| (needs.build-macos.result == 'success' || needs.build-macos.result == 'skipped') && | |
| (needs.build-windows.result == 'success' || needs.build-windows.result == 'skipped') && | |
| (needs.build-linux.result == 'success' || needs.build-linux.result == 'skipped') | |
| uses: ./.github/workflows/create-draft-release.yml | |
| secrets: inherit | |
| with: | |
| version: ${{ needs.prepare.outputs.version }} | |
| version_tag: ${{ needs.prepare.outputs.version_tag }} | |
| artifact_names: 'macos-build,windows-build,linux-build' | |
| summary: | |
| needs: [prepare, build-macos, build-windows, build-linux, build-setapp, create-draft] | |
| if: always() | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Generate summary | |
| run: | | |
| echo "# 📦 Build Complete: v${{ needs.prepare.outputs.version }}" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "**Variant**: ${{ needs.prepare.outputs.build_variant }}" >> $GITHUB_STEP_SUMMARY | |
| if [ -n "${{ inputs.custom_url }}" ]; then | |
| echo "**Custom URL**: ${{ inputs.custom_url }}" >> $GITHUB_STEP_SUMMARY | |
| fi | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "**Platforms Built**:" >> $GITHUB_STEP_SUMMARY | |
| echo "- macOS: ${{ needs.build-macos.result == 'success' && '✅' || '⬜' }}" >> $GITHUB_STEP_SUMMARY | |
| echo "- Windows: ${{ needs.build-windows.result == 'success' && '✅' || '⬜' }}" >> $GITHUB_STEP_SUMMARY | |
| echo "- Linux: ${{ needs.build-linux.result == 'success' && '✅' || '⬜' }}" >> $GITHUB_STEP_SUMMARY | |
| echo "- Setapp: ${{ needs.build-setapp.result == 'success' && '✅' || '⬜' }}" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| if [ "${{ needs.create-draft.result }}" == "success" ]; then | |
| echo "**🎉 Draft Release**: [View Releases](https://github.com/${{ github.repository }}/releases)" >> $GITHUB_STEP_SUMMARY | |
| else | |
| echo "**📥 Artifacts**: [Download from Run](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }})" >> $GITHUB_STEP_SUMMARY | |
| fi |