This repository was archived by the owner on Mar 22, 2026. It is now read-only.
Nightly Build #116
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: Nightly Build | |
| on: | |
| push: | |
| branches: | |
| - main | |
| paths-ignore: | |
| - "README.md" | |
| - ".github/**" | |
| - ".vscode/**" | |
| - ".idea/**" | |
| - "test/**" | |
| - ".gitignore" | |
| schedule: | |
| - cron: "0 18 * * *" | |
| jobs: | |
| build_ios: | |
| name: Build Unsigned iOS IPA | |
| runs-on: macos-15 | |
| steps: | |
| - name: Checkout Repository | |
| uses: actions/checkout@v4.2.2 | |
| - name: Get version from pubspec.yaml | |
| id: get_version | |
| run: | | |
| VERSION=$(grep '^version:' pubspec.yaml | sed 's/version: //' | sed 's/+.*//') | |
| echo "version=$VERSION" >> $GITHUB_OUTPUT | |
| echo "Version: $VERSION" | |
| - name: Get commit hash | |
| id: get_commit | |
| run: | | |
| COMMIT_HASH=$(git rev-parse --short HEAD) | |
| echo "hash=$COMMIT_HASH" >> $GITHUB_OUTPUT | |
| echo "Commit Hash: $COMMIT_HASH" | |
| - name: Set up Flutter | |
| uses: subosito/flutter-action@v2.14.0 | |
| with: | |
| flutter-version: "3.38.9" | |
| cache: true | |
| cache-key: "flutter-:os:-:channel:-:version:-:arch:-:hash:" | |
| cache-path: "${{ runner.tool_cache }}/flutter/:channel:-:version:-:arch:" | |
| - name: Cache Pub Dependencies | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.pub-cache | |
| ${{ github.workspace }}/.dart_tool | |
| key: ${{ runner.os }}-pub-${{ hashFiles('**/pubspec.lock') }} | |
| restore-keys: | | |
| ${{ runner.os }}-pub- | |
| - name: Cache CocoaPods | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ios/Pods | |
| ~/Library/Caches/CocoaPods | |
| ~/.cocoapods | |
| key: ${{ runner.os }}-pods-${{ hashFiles('**/Podfile.lock') }} | |
| restore-keys: | | |
| ${{ runner.os }}-pods- | |
| - name: Install Flutter Dependencies | |
| run: flutter pub get | |
| - name: Install CocoaPods Dependencies | |
| run: | | |
| cd ios | |
| pod install | |
| cd .. | |
| - name: Create config.json | |
| run: | | |
| cat <<EOF > config.json | |
| { | |
| "BUILD_VERSION": "${{ steps.get_version.outputs.version }}", | |
| "BUILD_NUMBER": "${{ github.run_number }}", | |
| "COMMIT_HASH": "${{ steps.get_commit.outputs.hash }}", | |
| "MAIMAI_NET_API_AES_KEY": "${{ secrets.MAIMAI_NET_API_AES_KEY }}", | |
| "MAIMAI_NET_API_AES_IV": "${{ secrets.MAIMAI_NET_API_AES_IV }}", | |
| "MAIMAI_NET_API_OBFUSCATE_PARAM": "${{ secrets.MAIMAI_NET_API_OBFUSCATE_PARAM }}", | |
| "MAIMAI_NET_API_KEYCHIP_ID": "${{ secrets.MAIMAI_NET_API_KEYCHIP_ID }}", | |
| "MAIMAI_NET_API_SALT": "${{ secrets.MAIMAI_NET_API_SALT }}", | |
| "MAIMAI_NET_API_OPEN_GAME_ID": "${{ secrets.MAIMAI_NET_API_OPEN_GAME_ID }}", | |
| "MAIMAI_NET_API_CHIME_ENDPOINT": "${{ secrets.MAIMAI_NET_API_CHIME_ENDPOINT }}", | |
| "MAIMAI_NET_API_TITLE_ENDPOINT": "${{ secrets.MAIMAI_NET_API_TITLE_ENDPOINT }}", | |
| "MAIMAI_NET_API_OPEN_GAME_ID": "${{ secrets.MAIMAI_NET_API_OPEN_GAME_ID }}", | |
| "MAIMAI_NET_API_MAI_ENCODING": "${{ secrets.MAIMAI_NET_API_MAI_ENCODING }}" | |
| } | |
| EOF | |
| - name: Build iOS App (Unsign) | |
| run: | | |
| flutter build ios --release --no-codesign \ | |
| --build-name=${{ steps.get_version.outputs.version }} \ | |
| --build-number=${{ github.run_number }} \ | |
| --dart-define-from-file=config.json | |
| - name: Package Unsigned IPA | |
| run: | | |
| mkdir -p Payload | |
| cp -r build/ios/iphoneos/Runner.app Payload/ | |
| zip -r RankHub-${{ steps.get_version.outputs.version }}+${{ github.run_number }}.ipa Payload | |
| rm -rf Payload | |
| - name: Upload Unsigned IPA | |
| uses: actions/upload-artifact@v4.3.3 | |
| with: | |
| name: RankHub-iOS-${{ steps.get_version.outputs.version }}+${{ github.run_number }} | |
| path: RankHub-${{ steps.get_version.outputs.version }}+${{ github.run_number }}.ipa | |
| build_android: | |
| name: Build Android APK | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout Repository | |
| uses: actions/checkout@v4.2.2 | |
| - name: Get version from pubspec.yaml | |
| id: get_version | |
| run: | | |
| VERSION=$(grep '^version:' pubspec.yaml | sed 's/version: //' | sed 's/+.*//') | |
| echo "version=$VERSION" >> $GITHUB_OUTPUT | |
| echo "Version: $VERSION" | |
| - name: Get commit hash | |
| id: get_commit | |
| run: | | |
| COMMIT_HASH=$(git rev-parse --short HEAD) | |
| echo "hash=$COMMIT_HASH" >> $GITHUB_OUTPUT | |
| echo "Commit Hash: $COMMIT_HASH" | |
| - name: Set up Flutter | |
| uses: subosito/flutter-action@v2.14.0 | |
| with: | |
| flutter-version: "3.38.9" | |
| cache: true | |
| cache-key: "flutter-:os:-:channel:-:version:-:arch:-:hash:" | |
| cache-path: "${{ runner.tool_cache }}/flutter/:channel:-:version:-:arch:" | |
| - name: Cache Pub Dependencies | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.pub-cache | |
| ${{ github.workspace }}/.dart_tool | |
| key: ${{ runner.os }}-pub-${{ hashFiles('**/pubspec.lock') }} | |
| restore-keys: | | |
| ${{ runner.os }}-pub- | |
| - name: Cache Gradle | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.gradle/caches | |
| ~/.gradle/wrapper | |
| android/.gradle | |
| key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} | |
| restore-keys: | | |
| ${{ runner.os }}-gradle- | |
| - name: Install Flutter Dependencies | |
| run: flutter pub get | |
| - name: Decode Keystore | |
| run: echo "${{ secrets.ANDROID_RELEASE_KEY }}" | base64 --decode > android/app/release.keystore | |
| - name: Create key.properties | |
| run: | | |
| cat <<EOF > android/key.properties | |
| storePassword=${{ secrets.ANDROID_RELEASE_KEY_PASSWORD }} | |
| keyPassword=${{ secrets.ANDROID_RELEASE_KEY_PASSWORD }} | |
| keyAlias=upload | |
| storeFile=release.keystore | |
| EOF | |
| - name: Create config.json | |
| run: | | |
| cat <<EOF > config.json | |
| { | |
| "BUILD_VERSION": "${{ steps.get_version.outputs.version }}", | |
| "BUILD_NUMBER": "${{ github.run_number }}", | |
| "COMMIT_HASH": "${{ steps.get_commit.outputs.hash }}", | |
| "MAIMAI_NET_API_AES_KEY": "${{ secrets.MAIMAI_NET_API_AES_KEY }}", | |
| "MAIMAI_NET_API_AES_IV": "${{ secrets.MAIMAI_NET_API_AES_IV }}", | |
| "MAIMAI_NET_API_OBFUSCATE_PARAM": "${{ secrets.MAIMAI_NET_API_OBFUSCATE_PARAM }}", | |
| "MAIMAI_NET_API_KEYCHIP_ID": "${{ secrets.MAIMAI_NET_API_KEYCHIP_ID }}", | |
| "MAIMAI_NET_API_SALT": "${{ secrets.MAIMAI_NET_API_SALT }}", | |
| "MAIMAI_NET_API_OPEN_GAME_ID": "${{ secrets.MAIMAI_NET_API_OPEN_GAME_ID }}", | |
| "MAIMAI_NET_API_CHIME_ENDPOINT": "${{ secrets.MAIMAI_NET_API_CHIME_ENDPOINT }}", | |
| "MAIMAI_NET_API_TITLE_ENDPOINT": "${{ secrets.MAIMAI_NET_API_TITLE_ENDPOINT }}", | |
| "MAIMAI_NET_API_OPEN_GAME_ID": "${{ secrets.MAIMAI_NET_API_OPEN_GAME_ID }}", | |
| "MAIMAI_NET_API_MAI_ENCODING": "${{ secrets.MAIMAI_NET_API_MAI_ENCODING }}" | |
| } | |
| EOF | |
| - name: Build Android APK | |
| run: | | |
| flutter build apk --split-per-abi --release \ | |
| --build-number=${{ github.run_number }} \ | |
| --dart-define-from-file=config.json | |
| env: | |
| KEYSTORE_PASSWORD: ${{ secrets.ANDROID_RELEASE_KEY_PASSWORD }} | |
| KEY_ALIAS: key | |
| KEY_PASSWORD: ${{ secrets.ANDROID_RELEASE_KEY_PASSWORD }} | |
| - name: Rename APK files with version | |
| run: | | |
| mv build/app/outputs/flutter-apk/app-arm64-v8a-release.apk \ | |
| build/app/outputs/flutter-apk/RankHub-${{ steps.get_version.outputs.version }}+${{ github.run_number }}-arm64-v8a.apk | |
| mv build/app/outputs/flutter-apk/app-armeabi-v7a-release.apk \ | |
| build/app/outputs/flutter-apk/RankHub-${{ steps.get_version.outputs.version }}+${{ github.run_number }}-armeabi-v7a.apk | |
| mv build/app/outputs/flutter-apk/app-x86_64-release.apk \ | |
| build/app/outputs/flutter-apk/RankHub-${{ steps.get_version.outputs.version }}+${{ github.run_number }}-x86_64.apk | |
| - name: Upload arm64-v8a APK | |
| uses: actions/upload-artifact@v4.3.3 | |
| with: | |
| name: RankHub-Android-${{ steps.get_version.outputs.version }}+${{ github.run_number }}-arm64-v8a | |
| path: build/app/outputs/flutter-apk/RankHub-${{ steps.get_version.outputs.version }}+${{ github.run_number }}-arm64-v8a.apk | |
| - name: Upload armeabi-v7a APK | |
| uses: actions/upload-artifact@v4.3.3 | |
| with: | |
| name: RankHub-Android-${{ steps.get_version.outputs.version }}+${{ github.run_number }}-armeabi-v7a | |
| path: build/app/outputs/flutter-apk/RankHub-${{ steps.get_version.outputs.version }}+${{ github.run_number }}-armeabi-v7a.apk | |
| - name: Upload x86_64 APK | |
| uses: actions/upload-artifact@v4.3.3 | |
| with: | |
| name: RankHub-Android-${{ steps.get_version.outputs.version }}+${{ github.run_number }}-x86_64 | |
| path: build/app/outputs/flutter-apk/RankHub-${{ steps.get_version.outputs.version }}+${{ github.run_number }}-x86_64.apk |