This repository was archived by the owner on Dec 19, 2025. It is now read-only.
Update main.yml #88
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 and Notify | |
| on: | |
| push: | |
| branches: [ main ] | |
| pull_request: | |
| branches: [ main ] | |
| workflow_dispatch: | |
| inputs: | |
| confirm: | |
| description: "Confirm to proceed with the build?" | |
| required: true | |
| type: boolean | |
| Mobile: | |
| description: "Include Android and iOS builds?" | |
| required: true | |
| type: boolean | |
| default: true | |
| env: | |
| ARGS: "-D officialBuild -D NotDeveloper" | |
| HAXE_VERSION: 4.3.6 | |
| jobs: | |
| confirm: | |
| if: ${{ github.event_name != 'workflow_dispatch' || github.event.inputs.confirm == 'true' }} | |
| runs-on: ubuntu-latest | |
| steps: | |
| - run: echo "Build confirmed. Proceeding with the build." | |
| setup-haxe: | |
| runs-on: ubuntu-latest | |
| needs: confirm | |
| steps: | |
| - uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.haxelib | |
| ~/.lime | |
| key: ${{ runner.os }}-haxe-${{ hashFiles('Project.xml', '**/*.hxml', '**/haxelib.json') }} | |
| restore-keys: ${{ runner.os }}-haxe- | |
| version: | |
| name: Define Version | |
| runs-on: ubuntu-latest | |
| needs: setup-haxe | |
| outputs: | |
| version_tag: ${{ steps.setver.outputs.version }} | |
| steps: | |
| - id: setver | |
| run: echo "version=4.0.0-${{ github.run_id }}" >> "$GITHUB_OUTPUT" | |
| - run: echo "4.0.0-${{ github.run_id }}" > VERSION | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: Version | |
| path: VERSION | |
| buildLinux: | |
| runs-on: ubuntu-latest | |
| needs: version | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| name: Version | |
| - uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.haxelib | |
| ~/.lime | |
| key: ${{ runner.os }}-haxe-${{ hashFiles('Project.xml', '**/*.hxml', '**/haxelib.json') }} | |
| restore-keys: ${{ runner.os }}-haxe- | |
| - uses: krdlab/setup-haxe@master | |
| with: | |
| haxe-version: ${{ env.HAXE_VERSION }} | |
| - run: | | |
| haxelib setup ~/haxelib | |
| haxelib install hxcpp --quiet | |
| haxelib install lime --quiet | |
| haxelib install openfl --quiet | |
| chmod +x ./setup/unix.sh | |
| ./setup/unix.sh | |
| - run: haxelib run lime build Project.xml linux --app-version="$(cat VERSION)" "$ARGS" | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: Linux Build | |
| path: export/release/linux/bin | |
| if-no-files-found: warn | |
| compression-level: 9 | |
| buildWindows: | |
| runs-on: windows-latest | |
| needs: version | |
| strategy: | |
| matrix: | |
| arch: [64, 32] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| name: Version | |
| - uses: actions/cache@v4 | |
| with: | |
| path: | | |
| C:\\haxelib | |
| key: windows-haxe-${{ hashFiles('Project.xml', '**/*.hxml', '**/haxelib.json') }} | |
| restore-keys: windows-haxe- | |
| - uses: krdlab/setup-haxe@master | |
| with: | |
| haxe-version: ${{ env.HAXE_VERSION }} | |
| - run: | | |
| haxelib setup C:/haxelib | |
| haxelib install hxcpp --quiet | |
| setup\windows.bat | |
| shell: cmd | |
| - run: haxelib run lime build windows ${{ matrix.arch == 32 && '-32 -D 32bits' || '' }} --app-version="$(cat VERSION)" "$ARGS" | |
| shell: bash | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: Windows Build (x${{ matrix.arch }}) | |
| path: export/${{ matrix.arch == 64 && 'release' || '32bit' }}/windows/bin | |
| if-no-files-found: warn | |
| compression-level: 9 | |
| buildMac: | |
| runs-on: macos-13 | |
| needs: version | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| name: Version | |
| - uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.haxelib | |
| ~/.lime | |
| key: macos-haxe-${{ hashFiles('Project.xml', '**/*.hxml', '**/haxelib.json') }} | |
| restore-keys: macos-haxe- | |
| - uses: krdlab/setup-haxe@master | |
| with: | |
| haxe-version: ${{ env.HAXE_VERSION }} | |
| - run: | | |
| haxelib setup ~/haxelib | |
| haxelib install hxcpp --quiet | |
| haxelib install lime --quiet | |
| haxelib install openfl --quiet || true | |
| haxelib run lime rebuild lime mac -64 | |
| haxelib run lime rebuild lime mac -Dmac-catalyst -Dmac-arm64 | |
| chmod +x ./setup/unix.sh | |
| ./setup/unix.sh | |
| - run: haxelib run lime build mac --app-version="$(cat VERSION)" "$ARGS" | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: macOS Build | |
| path: export/release/macos/bin | |
| if-no-files-found: warn | |
| compression-level: 9 | |
| buildAndroid: | |
| if: ${{ github.event_name != 'workflow_dispatch' || github.event.inputs.Mobile == 'true' }} | |
| runs-on: ubuntu-latest | |
| needs: version | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| name: Version | |
| - uses: actions/setup-java@v4 | |
| with: | |
| distribution: 'temurin' | |
| java-version: '17' | |
| - uses: krdlab/setup-haxe@master | |
| with: | |
| haxe-version: ${{ env.HAXE_VERSION }} | |
| - uses: android-actions/setup-android@v3 | |
| - uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.gradle/caches | |
| ~/.gradle/wrapper | |
| key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} | |
| restore-keys: ${{ runner.os }}-gradle- | |
| - uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.haxelib | |
| ~/.lime | |
| key: ${{ runner.os }}-haxe-${{ hashFiles('Project.xml', '**/*.hxml', '**/haxelib.json') }} | |
| restore-keys: ${{ runner.os }}-haxe- | |
| - run: | | |
| haxelib setup ~/haxelib | |
| haxelib install hxcpp --quiet | |
| haxelib install lime --quiet | |
| haxelib install openfl --quiet || true | |
| chmod +x ./setup/unix.sh | |
| ./setup/unix.sh | |
| haxelib run openfl setup android | |
| flixel-tools setup android | |
| haxelib run lime setup android | |
| - run: lime setup android | |
| - run: haxelib run lime build android --app-version="$(cat VERSION)" "$ARGS" | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: Android Build | |
| path: export/release/android/bin | |
| if-no-files-found: warn | |
| compression-level: 9 | |
| buildiOS: | |
| if: ${{ github.event_name != 'workflow_dispatch' || github.event.inputs.Mobile == 'true' }} | |
| runs-on: macos-13 | |
| needs: version | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| name: Version | |
| - uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.haxelib | |
| ~/.lime | |
| key: macos-haxe-${{ hashFiles('Project.xml', '**/*.hxml', '**/haxelib.json') }} | |
| restore-keys: macos-haxe- | |
| - uses: krdlab/setup-haxe@master | |
| with: | |
| haxe-version: ${{ env.HAXE_VERSION }} | |
| - run: | | |
| haxelib setup ~/haxelib | |
| haxelib install hxcpp --quiet | |
| haxelib install lime --quiet | |
| haxelib install openfl --quiet | |
| chmod +x ./setup/unix.sh | |
| ./setup/unix.sh | |
| haxelib run openfl setup ios | |
| flixel-tools setup ios | |
| haxelib run lime setup ios | |
| - run: haxelib run lime build ios --app-version="$(cat VERSION)" "$ARGS" | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: iOS Build | |
| path: export/release/ios/bin/ | |
| if-no-files-found: warn | |
| compression-level: 9 | |
| notifyDiscord: | |
| runs-on: ubuntu-latest | |
| if: always() | |
| needs: | |
| - buildLinux | |
| - buildWindows | |
| - buildMac | |
| - buildAndroid | |
| - buildiOS | |
| - version | |
| steps: | |
| - name: Notify Discord | |
| env: | |
| DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK_URL }} | |
| RUN_URL: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} | |
| COMMIT_URL: https://github.com/${{ github.repository }}/commit/${{ github.sha }} | |
| BRANCH: ${{ github.ref_name }} | |
| COMMIT_MESSAGE: ${{ github.event.head_commit.message || github.event.pull_request.title || 'Manual Trigger' }} | |
| VERSION: ${{ needs.version.outputs.version_tag }} | |
| run: | | |
| check() { | |
| case "$1" in | |
| success) echo "✅ Success";; | |
| skipped) echo "⚪ Skipped";; | |
| *) echo "❌ Failed";; | |
| esac | |
| } | |
| STATUS_LINUX=$(check "${{ needs.buildLinux.result }}") | |
| STATUS_WIN=$(check "${{ needs.buildWindows.result }}") | |
| STATUS_MAC=$(check "${{ needs.buildMac.result }}") | |
| STATUS_ANDROID=$(check "${{ needs.buildAndroid.result }}") | |
| STATUS_IOS=$(check "${{ needs.buildiOS.result }}") | |
| TITLE="✅ All Builds Succeeded" | |
| COLOR=65280 | |
| for status in "$STATUS_LINUX" "$STATUS_WIN" "$STATUS_MAC" "$STATUS_ANDROID" "$STATUS_IOS"; do | |
| if [[ "$status" == "❌ Failed" ]]; then | |
| TITLE="❌ Build Failure Detected" | |
| COLOR=16711680 | |
| break | |
| fi | |
| done | |
| CONTENT="🖥️ **Desktop Builds**\n• Linux: $STATUS_LINUX\n• Windows: $STATUS_WIN\n• macOS: $STATUS_MAC\n\n📱 **Mobile Builds**\n• Android: $STATUS_ANDROID\n• iOS: $STATUS_IOS" | |
| curl -H "Content-Type: application/json" -X POST -d "{ | |
| \"embeds\": [{ | |
| \"title\": \"$TITLE\", | |
| \"description\": \"$CONTENT\", | |
| \"color\": $COLOR, | |
| \"fields\": [ | |
| { \"name\": \"📝 Commit Message\", \"value\": \"${COMMIT_MESSAGE}\" }, | |
| { \"name\": \"📦 Branch\", \"value\": \"$BRANCH\", \"inline\": true }, | |
| { \"name\": \"🔖 Commit\", \"value\": \"[View Commit]($COMMIT_URL)\", \"inline\": true }, | |
| { \"name\": \"🔗 Workflow Run\", \"value\": \"[Click Here]($RUN_URL)\" }, | |
| { \"name\": \"🧾 Version\", \"value\": \"$VERSION\" } | |
| ], | |
| \"footer\": { \"text\": \"Haxe CI • ${{ github.repository }}\" }, | |
| \"timestamp\": \"$(date -u +%Y-%m-%dT%H:%M:%SZ)\" | |
| }] | |
| }" "$DISCORD_WEBHOOK" |