|
| 1 | +name: Build Orchestrator |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + inputs: |
| 6 | + version: |
| 7 | + description: 'Version (YY.MM.DD - leave empty for auto-generation)' |
| 8 | + required: false |
| 9 | + type: string |
| 10 | + default: '' |
| 11 | + |
| 12 | + custom_url: |
| 13 | + description: 'Custom App URL (optional - disables auto-update, version bump, draft)' |
| 14 | + required: false |
| 15 | + type: string |
| 16 | + default: '' |
| 17 | + |
| 18 | + build_macos: |
| 19 | + description: '🍎 macOS (x64 + ARM64)' |
| 20 | + required: true |
| 21 | + type: boolean |
| 22 | + default: true |
| 23 | + |
| 24 | + build_windows: |
| 25 | + description: '🪟 Windows (x64)' |
| 26 | + required: true |
| 27 | + type: boolean |
| 28 | + default: true |
| 29 | + |
| 30 | + build_linux: |
| 31 | + description: '🐧 Linux (AppImage)' |
| 32 | + required: true |
| 33 | + type: boolean |
| 34 | + default: true |
| 35 | + |
| 36 | + build_setapp: |
| 37 | + description: '📦 Setapp (Universal macOS)' |
| 38 | + required: true |
| 39 | + type: boolean |
| 40 | + default: true |
| 41 | + |
| 42 | + build_variant: |
| 43 | + description: 'Build variant (ignored if custom URL provided)' |
| 44 | + required: true |
| 45 | + type: choice |
| 46 | + options: |
| 47 | + - production |
| 48 | + - beta |
| 49 | + default: production |
| 50 | + |
| 51 | +jobs: |
| 52 | + prepare: |
| 53 | + runs-on: ubuntu-latest |
| 54 | + outputs: |
| 55 | + version: ${{ steps.version.outputs.version }} |
| 56 | + version_tag: ${{ steps.version.outputs.tag }} |
| 57 | + should_bump_version: ${{ steps.logic.outputs.should_bump }} |
| 58 | + should_create_draft: ${{ steps.logic.outputs.should_draft }} |
| 59 | + build_variant: ${{ steps.logic.outputs.variant }} |
| 60 | + |
| 61 | + steps: |
| 62 | + - name: Generate or validate version |
| 63 | + id: version |
| 64 | + run: | |
| 65 | + if [ -z "${{ inputs.version }}" ]; then |
| 66 | + VERSION=$(date -u +'%y.%-m.%-d') |
| 67 | + echo "📅 Auto-generated: v$VERSION" |
| 68 | + else |
| 69 | + VERSION="${{ inputs.version }}" |
| 70 | + if [[ ! "$VERSION" =~ ^[0-9]{2}\.[0-9]{1,2}\.[0-9]{1,2}(-beta\.[0-9]+)?$ ]]; then |
| 71 | + echo "❌ Invalid version format" |
| 72 | + exit 1 |
| 73 | + fi |
| 74 | + echo "✅ Using: v$VERSION" |
| 75 | + fi |
| 76 | + echo "version=$VERSION" >> $GITHUB_OUTPUT |
| 77 | + echo "tag=v$VERSION" >> $GITHUB_OUTPUT |
| 78 | +
|
| 79 | + - name: Determine workflow logic |
| 80 | + id: logic |
| 81 | + run: | |
| 82 | + SHOULD_BUMP="true" |
| 83 | + SHOULD_DRAFT="false" |
| 84 | + VARIANT="${{ inputs.build_variant }}" |
| 85 | +
|
| 86 | + # Custom URL overrides |
| 87 | + if [ -n "${{ inputs.custom_url }}" ]; then |
| 88 | + echo "::notice title=Custom URL Mode::Auto-update disabled, version bump skipped, draft release skipped" |
| 89 | + SHOULD_BUMP="false" |
| 90 | + SHOULD_DRAFT="false" |
| 91 | + VARIANT="custom" |
| 92 | +
|
| 93 | + # Verify only standard platforms selected |
| 94 | + if [ "${{ inputs.build_setapp }}" == "true" ]; then |
| 95 | + echo "::error title=Invalid Configuration::Setapp builds not allowed with custom URL" |
| 96 | + exit 1 |
| 97 | + fi |
| 98 | + fi |
| 99 | +
|
| 100 | + # Draft release only for production + all platforms |
| 101 | + if [ "$VARIANT" == "production" ] && \ |
| 102 | + [ "${{ inputs.build_macos }}" == "true" ] && \ |
| 103 | + [ "${{ inputs.build_windows }}" == "true" ] && \ |
| 104 | + [ "${{ inputs.build_linux }}" == "true" ] && \ |
| 105 | + [ "${{ inputs.build_setapp }}" == "true" ]; then |
| 106 | + SHOULD_DRAFT="true" |
| 107 | + fi |
| 108 | +
|
| 109 | + # Beta builds don't get draft releases |
| 110 | + if [ "$VARIANT" == "beta" ]; then |
| 111 | + SHOULD_DRAFT="false" |
| 112 | + fi |
| 113 | +
|
| 114 | + echo "should_bump=$SHOULD_BUMP" >> $GITHUB_OUTPUT |
| 115 | + echo "should_draft=$SHOULD_DRAFT" >> $GITHUB_OUTPUT |
| 116 | + echo "variant=$VARIANT" >> $GITHUB_OUTPUT |
| 117 | +
|
| 118 | + bump-version: |
| 119 | + needs: prepare |
| 120 | + if: needs.prepare.outputs.should_bump_version == 'true' |
| 121 | + uses: ./.github/workflows/bump-version.yml |
| 122 | + with: |
| 123 | + version: ${{ needs.prepare.outputs.version }} |
| 124 | + |
| 125 | + build-macos: |
| 126 | + needs: [prepare, bump-version] |
| 127 | + if: | |
| 128 | + always() && |
| 129 | + inputs.build_macos == true && |
| 130 | + (needs.bump-version.result == 'success' || needs.bump-version.result == 'skipped') |
| 131 | + uses: ./.github/workflows/release_desktop_app.yml |
| 132 | + secrets: inherit |
| 133 | + with: |
| 134 | + platform: macos-latest |
| 135 | + build_variant: ${{ needs.prepare.outputs.build_variant }} |
| 136 | + custom_url: ${{ inputs.custom_url }} |
| 137 | + git_ref: ${{ needs.bump-version.outputs.version_tag || github.ref }} |
| 138 | + |
| 139 | + build-windows: |
| 140 | + needs: [prepare, bump-version] |
| 141 | + if: | |
| 142 | + always() && |
| 143 | + inputs.build_windows == true && |
| 144 | + (needs.bump-version.result == 'success' || needs.bump-version.result == 'skipped') |
| 145 | + uses: ./.github/workflows/release_desktop_app.yml |
| 146 | + secrets: inherit |
| 147 | + with: |
| 148 | + platform: windows-latest |
| 149 | + build_variant: ${{ needs.prepare.outputs.build_variant }} |
| 150 | + custom_url: ${{ inputs.custom_url }} |
| 151 | + git_ref: ${{ needs.bump-version.outputs.version_tag || github.ref }} |
| 152 | + |
| 153 | + build-linux: |
| 154 | + needs: [prepare, bump-version] |
| 155 | + if: | |
| 156 | + always() && |
| 157 | + inputs.build_linux == true && |
| 158 | + (needs.bump-version.result == 'success' || needs.bump-version.result == 'skipped') |
| 159 | + uses: ./.github/workflows/release_desktop_app.yml |
| 160 | + secrets: inherit |
| 161 | + with: |
| 162 | + platform: ubuntu-latest |
| 163 | + build_variant: ${{ needs.prepare.outputs.build_variant }} |
| 164 | + custom_url: ${{ inputs.custom_url }} |
| 165 | + git_ref: ${{ needs.bump-version.outputs.version_tag || github.ref }} |
| 166 | + checkout_branch: draft-linux-fixes |
| 167 | + |
| 168 | + build-setapp: |
| 169 | + needs: [prepare, bump-version] |
| 170 | + if: | |
| 171 | + always() && |
| 172 | + inputs.build_setapp == true && |
| 173 | + inputs.custom_url == '' && |
| 174 | + (needs.bump-version.result == 'success' || needs.bump-version.result == 'skipped') |
| 175 | + uses: ./.github/workflows/build-setapp.yml |
| 176 | + secrets: inherit |
| 177 | + with: |
| 178 | + git_ref: ${{ needs.bump-version.outputs.version_tag || 'draft-setapp-wrapper-support' }} |
| 179 | + |
| 180 | + create-draft: |
| 181 | + needs: [prepare, build-macos, build-windows, build-linux] |
| 182 | + if: | |
| 183 | + always() && |
| 184 | + needs.prepare.outputs.should_create_draft == 'true' && |
| 185 | + (needs.build-macos.result == 'success' || needs.build-macos.result == 'skipped') && |
| 186 | + (needs.build-windows.result == 'success' || needs.build-windows.result == 'skipped') && |
| 187 | + (needs.build-linux.result == 'success' || needs.build-linux.result == 'skipped') |
| 188 | + uses: ./.github/workflows/create-draft-release.yml |
| 189 | + secrets: inherit |
| 190 | + with: |
| 191 | + version: ${{ needs.prepare.outputs.version }} |
| 192 | + version_tag: ${{ needs.prepare.outputs.version_tag }} |
| 193 | + artifact_names: 'macos-build,windows-build,linux-build' |
| 194 | + |
| 195 | + summary: |
| 196 | + needs: [prepare, build-macos, build-windows, build-linux, build-setapp, create-draft] |
| 197 | + if: always() |
| 198 | + runs-on: ubuntu-latest |
| 199 | + steps: |
| 200 | + - name: Generate summary |
| 201 | + run: | |
| 202 | + echo "# 📦 Build Complete: v${{ needs.prepare.outputs.version }}" >> $GITHUB_STEP_SUMMARY |
| 203 | + echo "" >> $GITHUB_STEP_SUMMARY |
| 204 | + echo "**Variant**: ${{ needs.prepare.outputs.build_variant }}" >> $GITHUB_STEP_SUMMARY |
| 205 | +
|
| 206 | + if [ -n "${{ inputs.custom_url }}" ]; then |
| 207 | + echo "**Custom URL**: ${{ inputs.custom_url }}" >> $GITHUB_STEP_SUMMARY |
| 208 | + fi |
| 209 | +
|
| 210 | + echo "" >> $GITHUB_STEP_SUMMARY |
| 211 | + echo "**Platforms Built**:" >> $GITHUB_STEP_SUMMARY |
| 212 | + echo "- macOS: ${{ needs.build-macos.result == 'success' && '✅' || '⬜' }}" >> $GITHUB_STEP_SUMMARY |
| 213 | + echo "- Windows: ${{ needs.build-windows.result == 'success' && '✅' || '⬜' }}" >> $GITHUB_STEP_SUMMARY |
| 214 | + echo "- Linux: ${{ needs.build-linux.result == 'success' && '✅' || '⬜' }}" >> $GITHUB_STEP_SUMMARY |
| 215 | + echo "- Setapp: ${{ needs.build-setapp.result == 'success' && '✅' || '⬜' }}" >> $GITHUB_STEP_SUMMARY |
| 216 | +
|
| 217 | + echo "" >> $GITHUB_STEP_SUMMARY |
| 218 | + if [ "${{ needs.create-draft.result }}" == "success" ]; then |
| 219 | + echo "**🎉 Draft Release**: [View Releases](https://github.com/${{ github.repository }}/releases)" >> $GITHUB_STEP_SUMMARY |
| 220 | + else |
| 221 | + echo "**📥 Artifacts**: [Download from Run](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }})" >> $GITHUB_STEP_SUMMARY |
| 222 | + fi |
0 commit comments