updated .github/workflows/main.yml #7
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 & Release" | |
on: | |
push: | |
tags: | |
- "v*" | |
jobs: | |
build-mac-ios-android: | |
runs-on: macos-latest | |
permissions: | |
contents: write | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: master | |
- name: Download Android keystore | |
id: android_keystore | |
uses: timheuer/base64-to-file@v1.2 | |
with: | |
fileName: keystore.jks | |
encodedString: ${{ secrets.KEYSTORE_BASE64 }} | |
- name: Create key.properties | |
run: | | |
echo "storeFile=${{ steps.android_keystore.outputs.filePath }}" > android/key.properties | |
echo "storePassword=${{ secrets.KEYSTORE_PASSWORD }}" >> android/key.properties | |
echo "keyPassword=${{ secrets.KEY_PASSWORD }}" >> android/key.properties | |
echo "keyAlias=${{ secrets.KEY_ALIAS }}" >> android/key.properties | |
- uses: actions/setup-java@v4 | |
with: | |
distribution: 'zulu' | |
java-version: "17" | |
cache: 'gradle' | |
- name: Flutter action | |
uses: subosito/flutter-action@v2 | |
with: | |
flutter-version: '3.24.x' | |
cache: true | |
- name: Restore packages | |
run: | | |
flutter pub get | |
- name: Install appdmg | |
run: npm install -g appdmg | |
- name: Install flutter_distributor | |
run: dart pub global activate flutter_distributor | |
- name: Build APK | |
run: | | |
flutter build apk --release --split-per-abi | |
- name: Upload APK to Artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: android | |
path: | | |
build/app/outputs/flutter-apk/app-armeabi-v7a-release.apk | |
build/app/outputs/flutter-apk/app-arm64-v8a-release.apk | |
build/app/outputs/flutter-apk/app-x86_64-release.apk | |
- name: Build IPA | |
run: | | |
flutter build ios --release --no-codesign | |
- name: Create IPA | |
run: | | |
mkdir build/ios/iphoneos/Payload | |
cp -R build/ios/iphoneos/Runner.app build/ios/iphoneos/Payload/Runner.app | |
cd build/ios/iphoneos/ | |
zip -q -r ios_no_sign.ipa Payload | |
cd ../../.. | |
- name: Upload IPA to Artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ios | |
path: | | |
build/ios/iphoneos/ios_no_sign.ipa | |
- name: Build MacOS | |
run: | | |
flutter_distributor package --platform macos --targets dmg,zip --skip-clean | |
- name: Upload MacOS to Artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: mac | |
path: | | |
dist/*/*.dmg | |
dist/*/*.zip | |
- name: Extract version from pubspec.yaml | |
id: yq | |
run: | | |
yq -r '.version' 'pubspec.yaml' | |
- name: Upload Release | |
uses: softprops/action-gh-release@v2 | |
with: | |
name: "${{ steps.yq.outputs.result }}" | |
token: ${{ secrets.TOKEN }} | |
files: | | |
build/app/outputs/flutter-apk/app-x86_64-release.apk | |
build/app/outputs/flutter-apk/app-arm64-v8a-release.apk | |
build/app/outputs/flutter-apk/app-armeabi-v7a-release.apk | |
build/ios/iphoneos/ios_no_sign.ipa | |
dist/*/*.dmg | |
dist/*/*.zip | |
- run: echo "🍏 This job's status is ${{ job.status }}." | |
build-windows: | |
runs-on: windows-latest | |
permissions: | |
contents: write | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: master | |
- name: Install yq command line utility | |
run: choco install yq | |
- name: Setup Flutter | |
uses: subosito/flutter-action@v2 | |
with: | |
flutter-version: "3.24.x" | |
cache: true | |
- name: Restore Packages | |
run: | | |
flutter pub get | |
- name: Install flutter_distributor | |
run: dart pub global activate flutter_distributor | |
- name: Build Windows | |
run: | | |
flutter_distributor package --platform windows --targets msix,zip --skip-clean | |
- name: Upload Windows APP to Artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: windows | |
path: | | |
dist/*/*.msix | |
dist/*/*.zip | |
- name: Extract version from pubspec.yaml | |
id: yq | |
run: | | |
yq -r '.version' 'pubspec.yaml' | |
- name: Upload Release | |
uses: softprops/action-gh-release@v2 | |
with: | |
name: "${{ steps.yq.outputs.result }}" | |
token: ${{ secrets.TOKEN }} | |
files: | | |
dist/*/*.msix | |
dist/*/*.zip | |
- run: echo "🍏 Windows job's status is ${{ job.status }}." |