From e54b25a9b40c46aa91bc322c2c935e9f8258b25c Mon Sep 17 00:00:00 2001 From: vndangkhoa Date: Sat, 3 Jan 2026 00:39:57 +0700 Subject: [PATCH] ci: add dedicated release workflow for easier APK deployments --- .github/workflows/ci.yml | 35 --------- .github/workflows/release.yml | 138 ++++++++++++++++++++++++++++++++++ 2 files changed, 138 insertions(+), 35 deletions(-) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5d27447..13087d4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -226,38 +226,3 @@ jobs: ${{ secrets.DOCKERHUB_USERNAME }}/streamflow:${{ steps.version.outputs.version }} cache-from: type=gha cache-to: type=gha,mode=max - - # ==================== - # Release (on tags only) - # ==================== - release: - name: Create GitHub Release - runs-on: ubuntu-latest - needs: [android-build, mobile-build] - if: startsWith(github.ref, 'refs/tags/v') - - steps: - - name: Download TV APK - uses: actions/download-artifact@v4 - with: - name: android-tv-debug - path: apks/tv - - - name: Download Mobile APK - uses: actions/download-artifact@v4 - with: - name: android-mobile-debug - path: apks/mobile - - - name: Prepare APKs - run: | - mv apks/tv/*.apk StreamFlix-TV.apk - mv apks/mobile/*.apk StreamFlix.apk - - - name: Create Release - uses: softprops/action-gh-release@v1 - with: - files: | - StreamFlix-TV.apk - StreamFlix.apk - generate_release_notes: true diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..98a52be --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,138 @@ +name: Release APKs + +on: + push: + tags: + - 'v*' + +env: + JAVA_VERSION: "21" + +jobs: + # ==================== + # Build Android TV APK + # ==================== + build-tv: + name: Build TV APK + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Set up JDK + uses: actions/setup-java@v4 + with: + distribution: 'temurin' + java-version: ${{ env.JAVA_VERSION }} + cache: 'gradle' + + - name: Grant execute permission + run: chmod +x android-tv/gradlew + + - name: Build Debug APK + run: | + cd android-tv + ./gradlew assembleDebug --no-daemon + + - name: Rename APK + run: mv android-tv/app/build/outputs/apk/debug/app-debug.apk StreamFlix-TV.apk + + - name: Upload APK + uses: actions/upload-artifact@v4 + with: + name: tv-apk + path: StreamFlix-TV.apk + + # ==================== + # Build Android Mobile APK + # ==================== + build-mobile: + name: Build Mobile APK + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Set up JDK + uses: actions/setup-java@v4 + with: + distribution: 'temurin' + java-version: ${{ env.JAVA_VERSION }} + cache: 'gradle' + + - name: Set up Node.js + uses: actions/setup-node@v4 + with: + node-version: '20' + cache: 'npm' + cache-dependency-path: frontend/package-lock.json + + - name: Install dependencies + run: | + cd frontend + npm ci + + - name: Build Web App + run: | + cd frontend + npm run build + + - name: Sync Capacitor + run: | + cd frontend + npx cap sync android --deployment + + - name: Grant execute permission + run: chmod +x frontend/android/gradlew + + - name: Build Mobile APK + run: | + cd frontend/android + ./gradlew assembleDebug --no-daemon + + - name: Rename APK + run: mv frontend/android/app/build/outputs/apk/debug/app-debug.apk StreamFlix.apk + + - name: Upload APK + uses: actions/upload-artifact@v4 + with: + name: mobile-apk + path: StreamFlix.apk + + # ==================== + # Create GitHub Release + # ==================== + release: + name: Create Release + runs-on: ubuntu-latest + needs: [build-tv, build-mobile] + permissions: + contents: write + + steps: + - uses: actions/checkout@v4 + + - name: Download TV APK + uses: actions/download-artifact@v4 + with: + name: tv-apk + + - name: Download Mobile APK + uses: actions/download-artifact@v4 + with: + name: mobile-apk + + - name: Get version from tag + id: version + run: echo "version=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT + + - name: Create Release + uses: softprops/action-gh-release@v2 + with: + name: ${{ steps.version.outputs.version }} - StreamFlix Release + files: | + StreamFlix-TV.apk + StreamFlix.apk + generate_release_notes: true + draft: false + prerelease: false