- Build for Android and iOS (#30.1) - push refs/tags/0.0.4 (from to ) #30
Workflow file for this run
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 for Android and iOS | |
run-name: > | |
${{ github.event.pull_request.title }} - ${{ github.workflow }} (#${{ github.run_number }}.${{ github.run_attempt }}) - ${{ github.event_name }} ${{ github.ref }} (from ${{ github.head_ref }} to ${{ github.base_ref }}) | |
on: | |
push: | |
tags: | |
- '*' | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
env: | |
flutter_version: '3.24.3' | |
java_version: '11' | |
jobs: | |
version: | |
runs-on: ubuntu-latest | |
outputs: | |
versionCode: ${{ steps.version-code.outputs.versionCode }} | |
versionName: ${{ steps.version-name.outputs.versionName }} | |
steps: | |
- name: Outputs versionName | |
id: version-name | |
run: | | |
echo "versionName=${{ github.ref_name }}" >> $GITHUB_OUTPUT | |
- name: Calculate version code from tag and output it into versionCode | |
id: version-code | |
run: | | |
tag=${{ github.ref_name }} | |
delimiter=. | |
tag_array=(${tag//$delimiter/ }) | |
major=${tag_array[0]} | |
minor=${tag_array[1]} | |
patch=${tag_array[2]} | |
version_code=$((major * 1000000 + minor * 1000 + patch)) | |
echo "versionCode=$version_code" >> $GITHUB_OUTPUT | |
build-android: | |
runs-on: ubuntu-latest | |
needs: version | |
env: | |
BUNDLE_GEMFILE: ${{ github.workspace }}/android/Gemfile | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: 'true' | |
token: ${{ secrets.PAT_TOKEN }} | |
- name: Ruby setup | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: 3.3 | |
bundler-cache: true | |
- name: Fastlane testing beta build | |
working-directory: ./android | |
run: | | |
pwd | |
ls -l | |
ls -l fastlane | |
bundle exec fastlane beta | |
# Remove before this line | |
- name: Cache Flutter installation | |
uses: actions/cache@v3 | |
with: | |
path: /opt/hostedtoolcache/flutter | |
key: ${{ runner.os }}-flutter-install-cache-${{ env.flutter_version }} | |
- name: Cache gradle dependencies | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.gradle/caches | |
~/.gradle/wrapper | |
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} | |
restore-keys: | | |
${{ runner.os }}-gradle- | |
- name: Prepare workspace files - keystore and key.properties | |
env: | |
KEYSTORE_BASE64: ${{ secrets.KEYSTORE_BASE64 }} | |
KEY_PROPERTIES_BASE64: ${{ secrets.KEY_PROPERTIES_BASE64 }} | |
run: | | |
echo $KEYSTORE_BASE64 | base64 --decode > "${{ github.workspace }}/android/app/key.jks" | |
echo $KEY_PROPERTIES_BASE64 | base64 --decode > "${{ github.workspace }}/android/key.properties" | |
echo "key.properties file: $(ls -l "${{ github.workspace }}/android/key.properties")" | |
echo "key.jks file: $(ls -l "${{ github.workspace }}/android/app/key.jks")" | |
- uses: actions/setup-java@v3 | |
with: | |
distribution: 'zulu' | |
java-version: '17' | |
cache: 'gradle' | |
- uses: subosito/flutter-action@v2 | |
with: | |
flutter-version: ${{ env.flutter_version }} | |
channel: 'stable' | |
- name: Cache Flutter packages | |
uses: actions/cache@v3 | |
with: | |
path: | # get FLUTTER_ROOT from flutter-action | |
${{ env.FLUTTER_ROOT }}/.pub-cache | |
key: ${{ runner.os }}-pub-cache-${{ hashFiles('**/pubspec.lock') }} | |
restore-keys: | | |
${{ runner.os }}-pub-cache- | |
- uses: dart-lang/setup-dart@v1 | |
with: | |
sdk: 'stable' | |
- run: flutter config --no-analytics | |
- run: flutter pub get | |
- name: build the environment | |
env: | |
ANDROID_APP_ID: ${{ secrets.ANDROID_APP_ID }} | |
ANDROID_BANNER_ID: ${{ secrets.ANDROID_BANNER_ID }} | |
ANDROID_NATIVE_ID: ${{ secrets.ANDROID_NATIVE_ID }} | |
IOS_APP_ID: ${{ secrets.IOS_APP_ID }} | |
IOS_BANNER_ID: ${{ secrets.IOS_BANNER_ID }} | |
IOS_NATIVE_ID: ${{ secrets.IOS_NATIVE_ID }} | |
TEST_ADS: ${{ secrets.TEST_ADS }} | |
run: dart tool/env.dart | |
- name: Activate flutter packages | |
run: | | |
flutter pub global activate intl_utils | |
- name: Generate files (freezed, json_serializable) | |
run: flutter pub run build_runner build --delete-conflicting-outputs | |
- name: Generate translations | |
run: | | |
flutter pub global run intl_utils:generate | |
- run: flutter test | |
- name: Build app bundle | |
env: | |
version_code: ${{ needs.version.outputs.versionCode }} | |
version_name: ${{ needs.version.outputs.versionName }} | |
run: | | |
echo "version_code: $version_code" | |
echo "version_name: $version_name" | |
flutter build appbundle --release --build-name $version_name --build-number $version_code | |
- name: Upload app bundle | |
uses: actions/upload-artifact@v4 | |
with: | |
name: app-release-aab | |
path: | | |
build/app/outputs/bundle/release/app-release.aab | |
build/app/outputs/mapping/release/mapping.txt | |
- name: Use Ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: 3.3 | |
bundler-cache: true # runs `bundle install` and caches installed gems automatically | |
- name: Deploy to Google Play - alpha track | |
working-directory: ./android | |
run: | | |
pwd | |
ls -l | |
bundle exec fastlane deploy | |
build-ios: | |
runs-on: macos-latest | |
needs: version | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Cache Flutter installation | |
uses: actions/cache@v3 | |
with: | |
path: /Users/runner/hostedtoolcache/flutter | |
key: ${{ runner.os }}-flutter-install-cache-${{ env.flutter_version }} | |
- uses: subosito/flutter-action@v2 | |
with: | |
flutter-version: ${{ env.flutter_version }} | |
channel: 'stable' | |
architecture: 'x64' | |
- uses: dart-lang/setup-dart@v1 | |
with: | |
sdk: 'stable' | |
- name: Cache Flutter packages | |
uses: actions/cache@v3 | |
with: | |
path: | # get FLUTTER_ROOT from flutter-action | |
${{ env.FLUTTER_ROOT }}/.pub-cache | |
key: ${{ runner.os }}-pub-cache-${{ hashFiles('**/pubspec.lock') }} | |
restore-keys: | | |
${{ runner.os }}-pub-cache- | |
- run: flutter config --no-analytics | |
- run: flutter --version | |
- run: flutter pub get | |
- name: build the environment | |
env: | |
ANDROID_APP_ID: ${{ secrets.ANDROID_APP_ID }} | |
ANDROID_BANNER_ID: ${{ secrets.ANDROID_BANNER_ID }} | |
ANDROID_NATIVE_ID: ${{ secrets.ANDROID_NATIVE_ID }} | |
IOS_APP_ID: ${{ secrets.IOS_APP_ID }} | |
IOS_BANNER_ID: ${{ secrets.IOS_BANNER_ID }} | |
IOS_NATIVE_ID: ${{ secrets.IOS_NATIVE_ID }} | |
TEST_ADS: ${{ secrets.TEST_ADS }} | |
run: dart tool/env.dart | |
- name: Generate files (freezed, json_serializable) | |
run: flutter pub run build_runner build --delete-conflicting-outputs | |
- name: Generate translations | |
run: | | |
flutter pub global activate intl_utils && flutter pub global run intl_utils:generate | |
- run: flutter test | |
- name: Build app bundle | |
env: | |
version_code: ${{ needs.version.outputs.versionCode }} | |
version_name: ${{ needs.version.outputs.versionName }} | |
run: | | |
echo "version_code: $version_code" | |
echo "version_name: $version_name" | |
flutter build ios --release --no-codesign --build-name $version_name --build-number $version_code | |
- name: Upload ios app | |
uses: actions/upload-artifact@v4 | |
with: | |
name: app-release-ipa | |
path: build/ios/iphoneos/Runner.app |