Build and Release Android APK #9
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 Release Android APK | |
| on: | |
| push: | |
| tags: | |
| - 'v*' | |
| workflow_dispatch: | |
| inputs: | |
| version: | |
| description: 'Version tag (e.g., v1.0.0)' | |
| required: false | |
| default: '' | |
| jobs: | |
| build-arm64: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| version: ${{ steps.get_version.outputs.version }} | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| cache: 'npm' | |
| - name: Setup Java | |
| uses: actions/setup-java@v4 | |
| with: | |
| distribution: 'temurin' | |
| java-version: '17' | |
| - name: Setup Android SDK | |
| uses: android-actions/setup-android@v3 | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Setup Expo | |
| uses: expo/expo-github-action@v8 | |
| with: | |
| expo-version: latest | |
| eas-version: latest | |
| token: ${{ secrets.EXPO_TOKEN }} | |
| - name: Get version from app.json | |
| id: get_version | |
| run: | | |
| VERSION=$(node -p "require('./app.json').expo.version") | |
| echo "version=$VERSION" >> $GITHUB_OUTPUT | |
| echo "App version: $VERSION" | |
| - name: Prebuild Android | |
| run: npx expo prebuild --platform android --clean | |
| - name: Build APK (arm64-v8a) | |
| run: | | |
| cd android | |
| ./gradlew assembleRelease \ | |
| -PreactNativeArchitectures=arm64-v8a \ | |
| --no-daemon | |
| env: | |
| GRADLE_OPTS: "-Dorg.gradle.jvmargs=-Xmx4g" | |
| - name: Rename and Upload arm64-v8a APK | |
| run: | | |
| VERSION=${{ steps.get_version.outputs.version }} | |
| mv android/app/build/outputs/apk/release/app-release.apk \ | |
| huawei-manager-v${VERSION}-arm64-v8a.apk | |
| - name: Upload arm64-v8a APK | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: apk-arm64-v8a | |
| path: huawei-manager-*.apk | |
| retention-days: 7 | |
| build-armv7: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| cache: 'npm' | |
| - name: Setup Java | |
| uses: actions/setup-java@v4 | |
| with: | |
| distribution: 'temurin' | |
| java-version: '17' | |
| - name: Setup Android SDK | |
| uses: android-actions/setup-android@v3 | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Setup Expo | |
| uses: expo/expo-github-action@v8 | |
| with: | |
| expo-version: latest | |
| eas-version: latest | |
| token: ${{ secrets.EXPO_TOKEN }} | |
| - name: Get version from app.json | |
| id: get_version | |
| run: | | |
| VERSION=$(node -p "require('./app.json').expo.version") | |
| echo "version=$VERSION" >> $GITHUB_OUTPUT | |
| echo "App version: $VERSION" | |
| - name: Prebuild Android | |
| run: npx expo prebuild --platform android --clean | |
| - name: Build APK (armeabi-v7a) | |
| run: | | |
| cd android | |
| ./gradlew assembleRelease \ | |
| -PreactNativeArchitectures=armeabi-v7a \ | |
| --no-daemon | |
| env: | |
| GRADLE_OPTS: "-Dorg.gradle.jvmargs=-Xmx4g" | |
| - name: Rename and Upload armeabi-v7a APK | |
| run: | | |
| VERSION=${{ steps.get_version.outputs.version }} | |
| mv android/app/build/outputs/apk/release/app-release.apk \ | |
| huawei-manager-v${VERSION}-armeabi-v7a.apk | |
| - name: Upload armeabi-v7a APK | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: apk-armeabi-v7a | |
| path: huawei-manager-*.apk | |
| retention-days: 7 | |
| build-universal: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| cache: 'npm' | |
| - name: Setup Java | |
| uses: actions/setup-java@v4 | |
| with: | |
| distribution: 'temurin' | |
| java-version: '17' | |
| - name: Setup Android SDK | |
| uses: android-actions/setup-android@v3 | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Setup Expo | |
| uses: expo/expo-github-action@v8 | |
| with: | |
| expo-version: latest | |
| eas-version: latest | |
| token: ${{ secrets.EXPO_TOKEN }} | |
| - name: Get version from app.json | |
| id: get_version | |
| run: | | |
| VERSION=$(node -p "require('./app.json').expo.version") | |
| echo "version=$VERSION" >> $GITHUB_OUTPUT | |
| echo "App version: $VERSION" | |
| - name: Prebuild Android | |
| run: npx expo prebuild --platform android --clean | |
| - name: Build Universal APK | |
| run: | | |
| cd android | |
| ./gradlew assembleRelease --no-daemon | |
| env: | |
| GRADLE_OPTS: "-Dorg.gradle.jvmargs=-Xmx4g" | |
| - name: Rename and Upload Universal APK | |
| run: | | |
| VERSION=${{ steps.get_version.outputs.version }} | |
| mv android/app/build/outputs/apk/release/app-release.apk \ | |
| huawei-manager-v${VERSION}-universal.apk | |
| - name: Upload Universal APK | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: apk-universal | |
| path: huawei-manager-*.apk | |
| retention-days: 7 | |
| release: | |
| runs-on: ubuntu-latest | |
| needs: [build-arm64, build-armv7, build-universal] | |
| steps: | |
| - name: Download all APKs | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: apks | |
| merge-multiple: true | |
| - name: List APKs | |
| run: ls -la apks/ | |
| - name: Create GitHub Release | |
| if: startsWith(github.ref, 'refs/tags/') | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| name: Huawei Manager v${{ needs.build-arm64.outputs.version }} | |
| body: | | |
| ## Huawei Manager v${{ needs.build-arm64.outputs.version }} | |
| ### Downloads | |
| - **arm64-v8a** - For modern 64-bit devices (recommended) | |
| - **armeabi-v7a** - For older 32-bit devices | |
| - **universal** - Works on all devices (larger size) | |
| ### Installation | |
| 1. Download the appropriate APK for your device | |
| 2. Enable "Install from unknown sources" in Settings | |
| 3. Open the APK file to install | |
| files: apks/*.apk | |
| draft: false | |
| prerelease: false | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Create Release (Manual Trigger) | |
| if: github.event_name == 'workflow_dispatch' && github.event.inputs.version != '' | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| tag_name: ${{ github.event.inputs.version }} | |
| name: Huawei Manager ${{ github.event.inputs.version }} | |
| body: | | |
| ## Huawei Manager ${{ github.event.inputs.version }} | |
| ### Downloads | |
| - **arm64-v8a** - For modern 64-bit devices (recommended) | |
| - **armeabi-v7a** - For older 32-bit devices | |
| - **universal** - Works on all devices (larger size) | |
| ### Installation | |
| 1. Download the appropriate APK for your device | |
| 2. Enable "Install from unknown sources" in Settings | |
| 3. Open the APK file to install | |
| files: apks/*.apk | |
| draft: false | |
| prerelease: false | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |