Build Final Flutter App #43
This file contains 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 Final Flutter App | |
on: workflow_dispatch | |
jobs: | |
build_android: | |
name: Build APK | |
runs-on: ubuntu-latest | |
env: | |
TMDB_API_READ: ${{ secrets.TMDB_API_READ }} | |
TMDB_API_KEY: ${{ secrets.TMDB_API_KEY }} | |
OMDB_API_KEY: ${{ secrets.OMDB_API_KEY }} | |
OMDB_API_KEY_FOR_SERIES: ${{ secrets.OMDB_API_KEY_FOR_SERIES }} | |
OMDB_API_KEY_FOR_EPISODES: ${{ secrets.OMDB_API_KEY_FOR_EPISODES }} | |
KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }} | |
KEY_ALIAS: ${{ secrets.KEY_ALIAS }} | |
KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }} | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Java | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'temurin' | |
java-version: '17' | |
- uses: subosito/flutter-action@v2 | |
with: | |
flutter-version: '3.19.0' | |
- uses: actions/checkout@v2 | |
- run: flutter pub get | |
- run: | | |
echo "TMDB_API_READ=${{ secrets.TMDB_API_READ }}" > .env | |
echo "TMDB_API_KEY=${{ secrets.TMDB_API_KEY }}" >> .env | |
echo "OMDB_API_KEY=${{ secrets.OMDB_API_KEY }}" >> .env | |
echo "OMDB_API_KEY_FOR_SERIES=${{ secrets.OMDB_API_KEY_FOR_SERIES }}" >> .env | |
echo "OMDB_API_KEY_FOR_EPISODES=${{ secrets.OMDB_API_KEY_FOR_EPISODES }}" >> .env | |
- name: Decode Keystore | |
run: | | |
echo "${{ secrets.KEYSTORE }}" | base64 --decode > android/app/keystore.jks | |
- name: Build APK | |
run: | | |
flutter build apk --release | |
env: | |
KEYSTORE_FILE: keystore.jks | |
KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }} | |
KEY_ALIAS: ${{ secrets.KEY_ALIAS }} | |
KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }} | |
- name: Verify APK signature (apksigner) | |
run: | | |
$ANDROID_HOME/build-tools/33.0.0/apksigner verify --verbose build/app/outputs/flutter-apk/app-release.apk | |
- name: Verify APK signature (jarsigner) | |
run: | | |
jarsigner -verify -verbose -certs build/app/outputs/flutter-apk/app-release.apk | |
- name: APK Info | |
run: | | |
$ANDROID_HOME/build-tools/33.0.0/aapt dump badging build/app/outputs/flutter-apk/app-release.apk | |
- name: List APK Directory | |
run: ls -alh ${{ github.workspace }}/build/app/outputs/flutter-apk | |
- name: Upload APK | |
uses: actions/upload-artifact@v4 | |
with: | |
name: apk | |
path: ${{ github.workspace }}/build/app/outputs/flutter-apk/app-release.apk | |
build_windows: | |
name: Build Windows | |
runs-on: windows-latest | |
env: | |
TMDB_API_READ: ${{ secrets.TMDB_API_READ }} | |
TMDB_API_KEY: ${{ secrets.TMDB_API_KEY }} | |
OMDB_API_KEY: ${{ secrets.OMDB_API_KEY }} | |
OMDB_API_KEY_FOR_SERIES: ${{ secrets.OMDB_API_KEY_FOR_SERIES }} | |
OMDB_API_KEY_FOR_EPISODES: ${{ secrets.OMDB_API_KEY_FOR_EPISODES }} | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: subosito/flutter-action@v2 | |
with: | |
flutter-version: '3.19.0' | |
- run: flutter pub get | |
- run: | | |
echo "TMDB_API_READ=${{ secrets.TMDB_API_READ }}" > .env | |
echo "TMDB_API_KEY=${{ secrets.TMDB_API_KEY }}" >> .env | |
echo "OMDB_API_KEY=${{ secrets.OMDB_API_KEY }}" >> .env | |
echo "OMDB_API_KEY_FOR_SERIES=${{ secrets.OMDB_API_KEY_FOR_SERIES }}" >> .env | |
echo "OMDB_API_KEY_FOR_EPISODES=${{ secrets.OMDB_API_KEY_FOR_EPISODES }}" >> .env | |
- run: mkdir -p ${{ github.workspace }}/build/windows/x64/runner/Release | |
- run: flutter build windows | |
- name: List Windows Build Directory | |
run: dir ${{ github.workspace }}/build/windows/x64/runner/Release | |
- name: zip everything | |
run: | | |
cd ${{ github.workspace }}/build/windows/x64/runner/Release | |
powershell -Command "Compress-Archive -Path * -DestinationPath mirarr-windows.zip" | |
- name: Upload binary | |
uses: actions/upload-artifact@v4 | |
with: | |
name: windows-zip | |
path: ${{ github.workspace }}/build/windows/x64/runner/Release/mirarr-windows.zip | |
build_linux: | |
name: Build Linux | |
runs-on: ubuntu-latest | |
env: | |
TMDB_API_READ: ${{ secrets.TMDB_API_READ }} | |
TMDB_API_KEY: ${{ secrets.TMDB_API_KEY }} | |
OMDB_API_KEY: ${{ secrets.OMDB_API_KEY }} | |
OMDB_API_KEY_FOR_SERIES: ${{ secrets.OMDB_API_KEY_FOR_SERIES }} | |
OMDB_API_KEY_FOR_EPISODES: ${{ secrets.OMDB_API_KEY_FOR_EPISODES }} | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: subosito/flutter-action@v2 | |
with: | |
flutter-version: '3.19.0' | |
- run: sudo apt-get update | |
- run: sudo apt-get install -y ninja-build cmake libgtk-3-dev | |
- run: flutter pub get | |
- run: | | |
echo "TMDB_API_READ=${{ secrets.TMDB_API_READ }}" > .env | |
echo "TMDB_API_KEY=${{ secrets.TMDB_API_KEY }}" >> .env | |
echo "OMDB_API_KEY=${{ secrets.OMDB_API_KEY }}" >> .env | |
echo "OMDB_API_KEY_FOR_SERIES=${{ secrets.OMDB_API_KEY_FOR_SERIES }}" >> .env | |
echo "OMDB_API_KEY_FOR_EPISODES=${{ secrets.OMDB_API_KEY_FOR_EPISODES }}" >> .env | |
- run: mkdir -p ${{ github.workspace }}/build/linux/x64/release/bundle | |
- run: flutter build linux | |
- name: List Linux Build Directory | |
run: ls -alh ${{ github.workspace }}/build/linux/x64/release/bundle | |
- name: zip everything | |
run: | | |
cd ${{ github.workspace }}/build/linux/x64/release/bundle | |
zip -r mirarr.zip * | |
- name: Upload binary | |
uses: actions/upload-artifact@v4 | |
with: | |
name: linux-zip | |
path: ${{ github.workspace }}/build/linux/x64/release/bundle/mirarr.zip | |
build_ios: | |
name: Build IOS | |
runs-on: macos-latest | |
env: | |
TMDB_API_READ: ${{ secrets.TMDB_API_READ }} | |
TMDB_API_KEY: ${{ secrets.TMDB_API_KEY }} | |
OMDB_API_KEY: ${{ secrets.OMDB_API_KEY }} | |
OMDB_API_KEY_FOR_SERIES: ${{ secrets.OMDB_API_KEY_FOR_SERIES }} | |
OMDB_API_KEY_FOR_EPISODES: ${{ secrets.OMDB_API_KEY_FOR_EPISODES }} | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: subosito/flutter-action@v2 | |
with: | |
flutter-version: '3.19.0' | |
- run: flutter pub get | |
- run: | | |
echo "TMDB_API_READ=${{ secrets.TMDB_API_READ }}" > .env | |
echo "TMDB_API_KEY=${{ secrets.TMDB_API_KEY }}" >> .env | |
echo "OMDB_API_KEY=${{ secrets.OMDB_API_KEY }}" >> .env | |
echo "OMDB_API_KEY_FOR_SERIES=${{ secrets.OMDB_API_KEY_FOR_SERIES }}" >> .env | |
echo "OMDB_API_KEY_FOR_EPISODES=${{ secrets.OMDB_API_KEY_FOR_EPISODES }}" >> .env | |
- run: flutter build ios --release --no-codesign | |
- name: Create IPA | |
run: | | |
cd build/ios/iphoneos | |
mkdir Payload | |
cp -r Runner.app Payload | |
zip -r mirarr.ipa Payload | |
- name: Upload binary | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ios-app | |
path: build/ios/iphoneos/mirarr.ipa | |
upload-release: | |
permissions: write-all | |
needs: [build_android, build_linux, build_windows, build_ios] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Read version from pubspec.yaml | |
id: version | |
run: | | |
VERSION=$(grep 'version:' pubspec.yaml | sed 's/version: //') | |
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT | |
- name: Download APK | |
uses: actions/download-artifact@v4 | |
with: | |
name: apk | |
path: ./out/android | |
- name: Download Windows ZIP | |
uses: actions/download-artifact@v4 | |
with: | |
name: windows-zip | |
path: ./out/windows | |
- name: Download Linux ZIP | |
uses: actions/download-artifact@v4 | |
with: | |
name: linux-zip | |
path: ./out/linux | |
- name: Download IOS IPA | |
uses: actions/download-artifact@v4 | |
with: | |
name: ios-app | |
path: ./out/ios | |
- name: List output directory | |
run: ls -R ./out | |
- name: Upload Release | |
uses: softprops/action-gh-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }} | |
with: | |
files: | | |
./out/android/* | |
./out/windows/* | |
./out/linux/* | |
./out/ios/* | |
tag_name: ${{ steps.version.outputs.VERSION }} | |
draft: false | |
prerelease: false |