Flutter Build #30
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: Flutter Build | |
on: | |
workflow_dispatch: | |
inputs: | |
build_android: | |
description: 'Build Android' | |
required: true | |
type: boolean | |
default: true | |
build_windows: | |
description: 'Build Windows' | |
required: true | |
type: boolean | |
default: true | |
build_macos: | |
description: 'Build macOS' | |
required: true | |
type: boolean | |
default: true | |
build_ios: | |
description: 'Build iOS' | |
required: true | |
type: boolean | |
default: true | |
jobs: | |
build-android: | |
if: ${{ inputs.build_android }} | |
runs-on: ubuntu-latest | |
env: | |
KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }} | |
KEY_ALIAS: ${{ secrets.KEY_ALIAS }} | |
KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup Java | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'zulu' | |
java-version: '17' | |
- name: Setup Flutter | |
uses: subosito/flutter-action@v2 | |
with: | |
flutter-version: '3.27.1' | |
channel: 'stable' | |
cache: true | |
- name: Setup Keystore | |
run: | | |
echo "${{ secrets.KEYSTORE_BASE64 }}" | base64 --decode > android/app/keystore.jks | |
shell: bash | |
- name: Get dependencies | |
run: flutter pub get | |
- name: Build APK | |
run: flutter build apk --release | |
- name: Upload APK | |
uses: actions/upload-artifact@v4 | |
with: | |
name: android-release | |
path: build/app/outputs/flutter-apk/app-release.apk | |
build-windows: | |
if: ${{ inputs.build_windows }} | |
runs-on: windows-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup Flutter | |
uses: subosito/flutter-action@v2 | |
with: | |
flutter-version: '3.27.1' | |
channel: 'stable' | |
cache: true | |
- name: Get dependencies | |
run: flutter pub get | |
- name: Build Windows | |
run: flutter build windows --release | |
- name: Create ZIP archive | |
run: | | |
Compress-Archive -Path build\windows\x64\runner\Release\* -DestinationPath windows-release.zip | |
- name: Upload Windows build | |
uses: actions/upload-artifact@v4 | |
with: | |
name: windows-release | |
path: windows-release.zip | |
compression-level: 9 | |
build-macos: | |
if: ${{ inputs.build_macos }} | |
runs-on: macos-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup Flutter | |
uses: subosito/flutter-action@v2 | |
with: | |
flutter-version: '3.27.1' | |
channel: 'stable' | |
cache: true | |
- name: Get dependencies | |
run: flutter pub get | |
- name: Enable macOS | |
run: flutter config --enable-macos-desktop | |
- name: Build macOS | |
run: flutter build macos --release | |
- name: Create APP ZIP | |
run: | | |
cd build/macos/Build/Products/Release | |
zip -r macos-release.zip *.app | |
- name: Upload macOS build | |
uses: actions/upload-artifact@v4 | |
with: | |
name: macos-release | |
path: build/macos/Build/Products/Release/macos-release.zip | |
compression-level: 9 | |
build-ios: | |
if: ${{ inputs.build_ios }} | |
runs-on: macos-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup Flutter | |
uses: subosito/flutter-action@v2 | |
with: | |
flutter-version: '3.27.1' | |
channel: 'stable' | |
cache: true | |
- name: Get dependencies | |
run: flutter pub get | |
- name: Build iOS | |
run: flutter build ios --release --no-codesign | |
- name: Create IPA | |
run: | | |
cd build/ios/iphoneos | |
mkdir Payload | |
cp -r Runner.app Payload | |
zip -r app-release.ipa Payload | |
- name: Upload iOS build | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ios-release | |
path: build/ios/iphoneos/app-release.ipa | |
compression-level: 9 |