This repository was archived by the owner on Dec 19, 2025. It is now read-only.
CHG | Fix bug in autobuild #137
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 | |
| permissions: | |
| contents: write | |
| discussions: write | |
| pull-requests: write | |
| issues: write | |
| on: | |
| push: | |
| branches: [ main ] | |
| tags: | |
| - 'v*' | |
| pull_request: | |
| branches: [ main ] | |
| workflow_dispatch: | |
| inputs: | |
| confirm: | |
| description: "Confirm to proceed with the build?" | |
| required: true | |
| type: boolean | |
| 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." | |
| 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: | |
| runs-on: ubuntu-latest | |
| needs: confirm | |
| 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 | |
| wait: | |
| runs-on: ubuntu-latest | |
| needs: [setup-haxe, version] | |
| steps: | |
| - run: echo "Haxe setup complete." | |
| buildLinux: | |
| runs-on: ubuntu-latest | |
| needs: [wait] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| name: Version | |
| - uses: krdlab/setup-haxe@master | |
| with: | |
| haxe-version: ${{ env.HAXE_VERSION }} | |
| - run: bash ./ci/setup-haxe.sh | |
| - run: haxelib run lime build Project.xml linux --app-version="$(cat VERSION)" "$ARGS" | |
| - run: zip -r HyperCodeEngine-Linux.zip export/release/linux/bin | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: Linux Build | |
| path: HyperCodeEngine-Linux.zip | |
| buildWindows: | |
| runs-on: windows-latest | |
| needs: [wait] | |
| strategy: | |
| matrix: | |
| arch: [64, 32] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| name: Version | |
| - uses: krdlab/setup-haxe@master | |
| with: | |
| haxe-version: ${{ env.HAXE_VERSION }} | |
| - run: setup\windows.bat | |
| shell: cmd | |
| - run: haxelib run lime build windows ${{ matrix.arch == 32 && '-32 -D 32bits -D HXCPP_M32' || '' }} --app-version="$(cat VERSION)" "$ARGS" | |
| shell: bash | |
| - run: powershell Compress-Archive -Path export/${{ matrix.arch == 64 && 'release' || '32bit' }}/windows/bin/* -DestinationPath HyperCodeEngine-Windows-x${{ matrix.arch }}.zip | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: Windows Build (x${{ matrix.arch }}) | |
| path: HyperCodeEngine-Windows-x${{ matrix.arch }}.zip | |
| buildMac: | |
| runs-on: macos-13 | |
| needs: [wait] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| name: Version | |
| - uses: krdlab/setup-haxe@master | |
| with: | |
| haxe-version: ${{ env.HAXE_VERSION }} | |
| - run: bash ./ci/setup-haxe.sh | |
| - run: haxelib run lime rebuild lime mac -64 | |
| - run: haxelib run lime build mac --app-version="$(cat VERSION)" "$ARGS" | |
| - run: ditto -c -k --sequesterRsrc --keepParent export/release/macos/bin/HyperCodeEngine.app HyperCodeEngine-macOS.zip | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: macOS Build | |
| path: HyperCodeEngine-macOS.zip | |
| setup-android-deps: | |
| runs-on: ubuntu-latest | |
| if: false | |
| needs: [wait] | |
| steps: | |
| - name: Install System Dependencies | |
| run: | | |
| sudo dpkg --add-architecture i386 | |
| sudo apt-get update | |
| sudo apt-get install -y \ | |
| build-essential \ | |
| gcc-multilib \ | |
| g++-multilib \ | |
| libc6-dev \ | |
| libc6-dev-i386 \ | |
| linux-libc-dev:i386 \ | |
| libstdc++6:i386 \ | |
| libgcc-s1:i386 \ | |
| zlib1g:i386 \ | |
| libncurses6:i386 \ | |
| libtinfo6:i386 \ | |
| libc++-dev \ | |
| lib32stdc++6 \ | |
| lib32gcc-s1 \ | |
| lib32z1 \ | |
| cmake \ | |
| ninja-build | |
| - name: Setup CMake | |
| uses: jwlawson/actions-setup-cmake@v2.0.2 | |
| with: | |
| cmake-version: '3.26.x' | |
| - name: Cache Dependencies | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| /usr/lib/i386-linux-gnu | |
| /usr/lib32 | |
| key: android-deps-${{ runner.os }}-${{ hashFiles('.github/workflows/main.yml') }} | |
| setup-android-env: | |
| runs-on: ubuntu-latest | |
| if: false | |
| needs: [setup-android-deps] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup Java JDK | |
| uses: actions/setup-java@main | |
| with: | |
| distribution: 'zulu' | |
| java-version: '18' | |
| - name: Setup Android NDK | |
| id: setup-ndk | |
| uses: nttld/setup-ndk@main | |
| with: | |
| ndk-version: r25c | |
| - name: Setup Android SDK | |
| uses: android-actions/setup-android@v3 | |
| with: | |
| cmdline-tools-version: latest | |
| - name: Set Android Environment Variables | |
| run: | | |
| echo "JAVA_HOME=$JAVA_HOME" >> $GITHUB_ENV | |
| echo "JDK_HOME=$JAVA_HOME" >> $GITHUB_ENV | |
| echo "CPPFLAGS=-I$JAVA_HOME/include -I$JAVA_HOME/include/linux" >> $GITHUB_ENV | |
| echo "CFLAGS=-I$JAVA_HOME/include -I$JAVA_HOME/include/linux" >> $GITHUB_ENV | |
| echo "ANDROID_HOME=$ANDROID_SDK_ROOT" >> $GITHUB_ENV | |
| echo "ANDROID_SDK=$ANDROID_SDK_ROOT" >> $GITHUB_ENV | |
| echo "ANDROID_NDK_HOME=${{ steps.setup-ndk.outputs.ndk-path }}" >> $GITHUB_ENV | |
| echo "ANDROID_NDK_ROOT=${{ steps.setup-ndk.outputs.ndk-path }}" >> $GITHUB_ENV | |
| echo "ANDROID_SDK_ROOT=$ANDROID_SDK_ROOT" >> $GITHUB_ENV | |
| setup-android-haxe: | |
| runs-on: ubuntu-latest | |
| if: false | |
| needs: [setup-android-env] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: krdlab/setup-haxe@master | |
| with: | |
| haxe-version: ${{ env.HAXE_VERSION }} | |
| - name: Setup Haxe Dependencies | |
| run: | | |
| haxelib setup ~/haxelib | |
| haxelib install lime | |
| haxelib install openfl | |
| haxelib install flixel | |
| haxelib git linc_luajit https://github.com/nebulazorua/linc_luajit.git | |
| haxelib run lime setup | |
| bash ./ci/setup-haxe.sh | |
| - name: Setup Lime for Android | |
| run: | | |
| haxelib run lime config ANDROID_SDK $ANDROID_SDK_ROOT | |
| haxelib run lime config ANDROID_NDK_ROOT $ANDROID_NDK_ROOT | |
| haxelib run lime setup android -y | |
| buildAndroid: | |
| runs-on: ubuntu-latest | |
| if: false | |
| needs: [setup-android-haxe] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| name: Version | |
| - name: Build Android | |
| run: | | |
| haxelib run lime rebuild hxcpp | |
| haxelib run lime rebuild android | |
| haxelib run lime build android --app-version="$(cat VERSION)" "$ARGS" | |
| - name: Package Android Build | |
| run: zip -r HyperCodeEngine-Android.zip export/release/android/bin | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: Android Build | |
| path: HyperCodeEngine-Android.zip | |
| buildiOS: # This too. | |
| runs-on: macos-13 | |
| if: false | |
| needs: [wait] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| name: Version | |
| - uses: krdlab/setup-haxe@master | |
| with: | |
| haxe-version: ${{ env.HAXE_VERSION }} | |
| - run: bash ./ci/setup-haxe.sh | |
| - run: haxelib run lime setup ios | |
| - run: haxelib run lime rebuild ios | |
| - run: haxelib run lime build ios --app-version="$(cat VERSION)" "$ARGS" -nosign | |
| - run: zip -r HyperCodeEngine-iOS.zip export/release/ios/bin | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: iOS Build | |
| path: HyperCodeEngine-iOS.zip | |
| check-build-status: | |
| runs-on: ubuntu-latest | |
| if: always() | |
| needs: | |
| - buildLinux | |
| - buildWindows | |
| - buildMac | |
| - buildAndroid | |
| - buildiOS | |
| - version | |
| outputs: | |
| status_linux: ${{ steps.check.outputs.linux }} | |
| status_windows: ${{ steps.check.outputs.windows }} | |
| status_mac: ${{ steps.check.outputs.mac }} | |
| status_android: ${{ steps.check.outputs.android }} | |
| status_ios: ${{ steps.check.outputs.ios }} | |
| all_success: ${{ steps.check.outputs.all_success }} | |
| steps: | |
| - id: check | |
| run: | | |
| check() { | |
| case "$1" in | |
| success) echo "✅ Success";; | |
| skipped) echo "⚪ Skipped";; | |
| *) echo "❌ Failed";; | |
| esac | |
| } | |
| echo "linux=$(check "${{ needs.buildLinux.result }}")" >> "$GITHUB_OUTPUT" | |
| echo "windows=$(check "${{ needs.buildWindows.result }}")" >> "$GITHUB_OUTPUT" | |
| echo "mac=$(check "${{ needs.buildMac.result }}")" >> "$GITHUB_OUTPUT" | |
| echo "android=$(check "${{ needs.buildAndroid.result }}")" >> "$GITHUB_OUTPUT" | |
| echo "ios=$(check "${{ needs.buildiOS.result }}")" >> "$GITHUB_OUTPUT" | |
| if [[ "${{ needs.buildLinux.result }}" == "success" ]] && \ | |
| [[ "${{ needs.buildWindows.result }}" == "success" ]] && \ | |
| [[ "${{ needs.buildMac.result }}" == "success" ]] && \ | |
| [[ "${{ needs.buildAndroid.result }}" == "skipped" ]] && \ | |
| [[ "${{ needs.buildiOS.result }}" == "skipped" ]]; then | |
| echo "all_success=true" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "all_success=false" >> "$GITHUB_OUTPUT" | |
| fi | |
| notify-discord-status: | |
| runs-on: ubuntu-latest | |
| needs: [check-build-status, version] | |
| if: always() | |
| 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 }} | |
| STATUS_LINUX: ${{ needs.check-build-status.outputs.status_linux }} | |
| STATUS_WIN: ${{ needs.check-build-status.outputs.status_windows }} | |
| STATUS_MAC: ${{ needs.check-build-status.outputs.status_mac }} | |
| STATUS_ANDROID: ${{ needs.check-build-status.outputs.status_android }} | |
| STATUS_IOS: ${{ needs.check-build-status.outputs.status_ios }} | |
| run: | | |
| TITLE="${{ needs.check-build-status.outputs.all_success == 'true' && '✅ All Builds Succeeded' || '❌ Build Failure Detected' }}" | |
| COLOR="${{ needs.check-build-status.outputs.all_success == 'true' && '65280' || '16711680' }}" | |
| 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" | |
| prepare-release: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| needs: | |
| - check-build-status | |
| - version | |
| if: always() | |
| outputs: | |
| release_id: ${{ steps.create_release.outputs.id }} | |
| should_upload: ${{ steps.check_upload.outputs.should_upload }} | |
| steps: | |
| - id: check_upload | |
| run: | | |
| if [[ "${{ needs.check-build-status.outputs.all_success }}" == "true" ]]; then | |
| echo "should_upload=true" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "⚠️ Some builds failed - skipping artifact upload" | |
| echo "should_upload=false" >> "$GITHUB_OUTPUT" | |
| fi | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Download artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: builds | |
| - name: Create GitHub Release | |
| id: create_release | |
| uses: actions/create-release@v1.1.4 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| tag_name: ${{ needs.version.outputs.version_tag }} | |
| release_name: "[AutoBuild] Experimental Release ${{ needs.version.outputs.version_tag }}" | |
| body: | | |
| 🚧 **[AutoBuild] Experimental Release – Use With Caution!** | |
| This release was automatically built from the latest changes pushed to the `main` branch. | |
| It is generated for testing, preview, and development purposes only, and is **not considered stable or production-ready**. | |
| --- | |
| ### ⚠️ Disclaimer: | |
| This version is **NOT an official release**. It may: | |
| - Contain incomplete or experimental features. | |
| - Include untested code or breaking changes. | |
| - Lack performance optimization or full support across platforms. | |
| - Be removed or overwritten in future automated builds. | |
| --- | |
| ### 📦 Build Information: | |
| - Version: `${{ needs.version.outputs.version_tag }}` | |
| - Branch: `main` | |
| - Commit: `${{ github.sha }}` | |
| - Trigger: `${{ github.event_name }}` | |
| - Timestamp: `$(date -u +"%Y-%m-%d %H:%M:%S UTC")` | |
| ### 🔗 Build Status: | |
| - Linux: `${{ needs.check-build-status.outputs.status_linux }}` | |
| - Windows: `${{ needs.check-build-status.outputs.status_windows }}` | |
| - macOS: `${{ needs.check-build-status.outputs.status_mac }}` | |
| - Android: `${{ needs.check-build-status.outputs.status_android }}` | |
| - iOS: `${{ needs.check-build-status.outputs.status_ios }}` | |
| - All Builds: `${{ needs.check-build-status.outputs.all_success }}` | |
| --- | |
| ### 📣 Reporting Issues | |
| Found a bug or unexpected behavior? Please open an issue on our GitHub repo and describe: | |
| - What you were doing | |
| - Expected vs actual results | |
| - OS and platform info | |
| - Attach logs/screenshots if possible | |
| --- | |
| 💬 Thanks for testing! Your feedback helps us improve the project before stable releases. | |
| Follow us or watch the repo to get notified about official updates. | |
| — HyperCode Engine AutoBuilder | |
| draft: false | |
| prerelease: true | |
| upload-artifacts: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| needs: [prepare-release, version] | |
| if: needs.prepare-release.outputs.should_upload == 'true' | |
| steps: | |
| - name: Download all build artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: builds | |
| - name: List download contents | |
| run: ls -R builds | |
| - name: Prepare artifacts for upload | |
| shell: bash | |
| run: | | |
| echo "🔍 Checking available artifacts..." | |
| shopt -s globstar nullglob | |
| # Use proper grouping for the find command | |
| find builds -type f \( -name "*.zip" -o -name "*.apk" -o -name "*.ipa" -o -name "*.dmg" \) | while read -r file; do | |
| echo "📦 Found artifact: $file" | |
| mkdir -p "release-artifacts" | |
| cp "$file" "release-artifacts/" | |
| echo "✓ Prepared $(basename "$file") for upload" | |
| done | |
| echo "📊 Summary of artifacts:" | |
| ls -lh release-artifacts/ | |
| - name: Upload Release Artifacts | |
| uses: softprops/action-gh-release@v2.2.2 | |
| with: | |
| tag_name: ${{ needs.version.outputs.version_tag }} | |
| files: | | |
| release-artifacts/* | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |