Build Android APK #32
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 Android APK | |
| on: | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| jobs: | |
| build_tv: | |
| name: Build Android TV APK | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Check out repository | |
| uses: actions/checkout@v3 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v3 | |
| with: | |
| node-version: 18 | |
| cache: "yarn" | |
| - name: Install dependencies | |
| run: yarn install --frozen-lockfile | |
| - name: Get version from package.json | |
| id: package-version | |
| run: echo "version=$(node -p "require('./package.json').version")" >> $GITHUB_OUTPUT | |
| - name: Setup JDK | |
| uses: actions/setup-java@v3 | |
| with: | |
| distribution: "zulu" | |
| java-version: "17" | |
| - name: Prebuild TV App | |
| run: yarn prebuild-tv | |
| - name: Build TV APK | |
| run: yarn build-tv | |
| - name: Upload TV APK | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: orion-tv-apk | |
| path: android/app/build/outputs/apk/release/app-release.apk | |
| build_mobile: | |
| name: Build Android Mobile APK | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Check out repository | |
| uses: actions/checkout@v3 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v3 | |
| with: | |
| node-version: 18 | |
| cache: "yarn" | |
| - name: Install dependencies | |
| run: yarn install --frozen-lockfile | |
| - name: Get version from package.json | |
| id: package-version | |
| run: echo "version=$(node -p "require('./package.json').version")" >> $GITHUB_OUTPUT | |
| - name: Setup JDK | |
| uses: actions/setup-java@v3 | |
| with: | |
| distribution: "zulu" | |
| java-version: "17" | |
| - name: Prebuild Mobile App | |
| run: yarn prebuild-mobile | |
| - name: Build Mobile APK | |
| run: yarn build-mobile | |
| - name: Upload Mobile APK | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: orion-mobile-apk | |
| path: android/app/build/outputs/apk/release/app-release.apk | |
| release: | |
| name: Create Release | |
| needs: [build_tv, build_mobile] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Check out repository | |
| uses: actions/checkout@v3 | |
| - name: Get version from package.json | |
| id: package-version | |
| run: echo "version=$(node -p "require('./package.json').version")" >> $GITHUB_OUTPUT | |
| - name: Download TV APK | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: orion-tv-apk | |
| path: artifacts/tv | |
| - name: Download Mobile APK | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: orion-mobile-apk | |
| path: artifacts/mobile | |
| - name: Rename APK files | |
| run: | | |
| mv artifacts/tv/app-release.apk artifacts/orionTV-tv.${{ steps.package-version.outputs.version }}.apk | |
| mv artifacts/mobile/app-release.apk artifacts/orionTV-mobile.${{ steps.package-version.outputs.version }}.apk | |
| - name: Create Release and Upload APKs | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: v${{ steps.package-version.outputs.version }} | |
| name: Release v${{ steps.package-version.outputs.version }} | |
| body: | | |
| Automated release for version v${{ steps.package-version.outputs.version }}. | |
| - orionTV-tv.${{ steps.package-version.outputs.version }}.apk - Android TV版本 | |
| - orionTV-mobile.${{ steps.package-version.outputs.version }}.apk - 手机/平板版本 | |
| draft: false | |
| prerelease: false | |
| files: | | |
| artifacts/orionTV-tv.${{ steps.package-version.outputs.version }}.apk | |
| artifacts/orionTV-mobile.${{ steps.package-version.outputs.version }}.apk | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |