ci: add dedicated release workflow for easier APK deployments

This commit is contained in:
vndangkhoa 2026-01-03 00:39:57 +07:00
parent 1893541864
commit e54b25a9b4
2 changed files with 138 additions and 35 deletions

View file

@ -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

138
.github/workflows/release.yml vendored Normal file
View file

@ -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