Build Build Build #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 Build Build | |
on: workflow_dispatch | |
env: | |
CI_PIPELINE_IID: ${{ github.run_number }} # Make sure when we actually build release builds it starts from 2009 | |
CI_COMMIT_REF_NAME: ${{ github.ref_name }} | |
FLUTTER_CHANNEL: "stable" | |
FLUTTER_VERSION: "3.7.11" | |
FLUTTER_PATH: /opt/hostedtoolcache/flutter #ubuntu-latest | |
#Encode the JSON key in base64 using this command base64 -w 0 service-account-example.json and paste the base64 string | |
jobs: | |
releaseapk: | |
runs-on: ubuntu-latest | |
name: Generate Release Flutter App # From "Generate Release Flutter App" in GitLab CI | |
env: | |
APP_BUILD_VER: beta | |
APP_TYPE: Android | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Install Flutter Stable | |
uses: subosito/flutter-action@v2 | |
with: | |
channel: ${{ env.FLUTTER_CHANNEL }} | |
flutter-version: ${{ env.FLUTTER_VERSION }} | |
cache: true | |
- name: Cache pubspec dependencies | |
uses: actions/cache@v3 | |
with: | |
path: | | |
${{ env.FLUTTER_HOME }}/.pub-cache | |
${{ env.PUB_CACHE }} | |
**/.packages | |
**/.flutter-plugins | |
**/.flutter-plugin-dependencies | |
**/.dart_tool/package_config.json | |
key: build-pubspec-${{ hashFiles('**/pubspec.lock') }} | |
restore-keys: build-pubspec- | |
# - name: Install JDK 11 | |
# uses: actions/setup-java@v3 | |
# with: | |
# distribution: 'zulu' | |
# java-version: '11' | |
# cache: 'gradle' | |
- name: Setup Android SDK | |
uses: android-actions/setup-android@v2 | |
- name: Trust GitHub Workspace | |
run: git config --global --add safe.directory "$GITHUB_WORKSPACE" | |
- name: Test Flutter Doctor | |
run: flutter doctor -v | |
- name: Retrieve Firebase Options Dart files and decode to file | |
env: | |
GOOGLE_SVC_ANDROID: ${{ secrets.GOOGLE_SVC_ANDROID }} | |
GOOGLE_SVC_DART: ${{ secrets.GOOGLE_SVC_DART }} | |
PUB_SEC_DART: ${{ secrets.PUB_SEC_DART }} | |
run: | | |
echo $GOOGLE_SVC_ANDROID | base64 -d > android/app/google-services.json | |
echo $GOOGLE_SVC_DART | base64 -d > lib/firebase_options.dart | |
- name: Obtain Debug Keystore from Secrets | |
env: | |
FLUTTER_KEYSTORE: ${{ secrets.FLUTTER_RELEASE_KEYSTORE }} | |
KEY_PROPERTIES: ${{ secrets.RELEASE_KEY_PROPERTIES }} | |
run: | | |
echo $FLUTTER_KEYSTORE | base64 -d > android/app/flutter.jks | |
echo $KEY_PROPERTIES | base64 -d > android/key.properties | |
- uses: benjlevesque/[email protected] | |
id: short-sha | |
with: | |
length: 8 | |
# # TODO: Add 2009 to CI_PIPELINE_IID until further notice to prevent build failure | |
# # TODO: Replace CI_PIPELINE_IID with GIT_COMMIT_COUNT in the future | |
# - name: Pre-Setup and obtain version information | |
# run: | | |
# mkdir release | |
# export GIT_COMMIT_COUNT="$(git rev-list --count HEAD)" | |
# export CI_PIPELINE_IID=$(($CI_PIPELINE_IID + 2009)) | |
# echo $GIT_COMMIT_COUNT | |
# echo $GIT_COMMIT_SHORT_SHA | |
# echo $CI_PIPELINE_IID | |
# chmod +x ./ciscripts/get_version.sh | |
# ./ciscripts/get_version.sh | |
# env: | |
# CI_COMMIT_SHORT_SHA: ${{ steps.short-sha.outputs.sha }} | |
## - name: Flutter Analyze | |
## run: flutter analyze --no-fatal-infos --no-fatal-warnings | |
# - name: Build Android Split APK | |
# run: | | |
# flutter build apk --target-platform android-arm,android-arm64,android-x64 --split-per-abi | |
# - name: Move Split APKs to Release folder | |
# run: mv ./build/app/outputs/apk/release/*.apk ./release | |
- name: Build Android Multi-Arch Fat APK | |
run: flutter build apk | |
- name: Move Fat APK to Release Folder | |
run: | | |
cp build/app/outputs/apk/release/app-release.apk ./release | |
cp build/app/outputs/apk/release/app-release.apk ./app-fatapk.apk | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: flutter-android-artifact-rel | |
path: | | |
release/ | |
app-fatapk.apk | |
LATEST | |
VERSION | |
- name: Build Android AppBundle | |
run: flutter build appbundle | |
- name: Move App Bundle to location | |
run: cp build/app/outputs/bundle/release/app-release.aab ./appbundle-signed.aab | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: flutter-android-aab-artifact-rel | |
path: | | |
release/ | |
android/ | |
appbundle-signed.aab | |
LATEST | |
VERSION | |
outputs: | |
relid: ${{ steps.versioninfo.outputs.pipeline_id }} | |
# generaterelease: | |
# runs-on: ubuntu-latest | |
# if: startsWith(github.ref, 'refs/tags/') | |
# needs: | |
# - releaseapk | |
# - releaseipa | |
# name: Upload Artifact + Deploy Artifact | |
# permissions: | |
# contents: write | |
# steps: | |
# - uses: actions/download-artifact@v3 | |
# with: | |
# name: flutter-android-artifact-rel | |
# - uses: actions/download-artifact@v3 | |
# with: | |
# name: flutter-unsigned-ipa-artifact-rel | |
# - name: Git Commit Data | |
# uses: rlespinasse/[email protected] | |
# - uses: benjlevesque/[email protected] | |
# id: short-sha | |
# with: | |
# length: 8 | |
# - name: Prep Release Notes | |
# env: | |
# CI_COMMIT_MESSAGE: ${{ env.GIT_COMMIT_MESSAGE_SUBJECT }} | |
# CI_COMMIT_SHORT_SHA: ${{ steps.short-sha.outputs.sha }} | |
# APP_BUILD_VER: beta | |
# run: | | |
# echo $CI_COMMIT_MESSAGE > release-beta.txt | |
# builddate="$(date +"%A, %d %B %Y %T %Z")" | |
# printf "\nRelease Notes\n" >> release-beta.txt | |
# cat LATEST >> release-beta.txt | |
# printf "\n\nAPK Built on $builddate on branch $CI_COMMIT_REF_NAME ($CI_COMMIT_SHORT_SHA), type $APP_BUILD_VER" >> release-beta.txt | |
# - name: Verify Release Notes | |
# run: cat release-beta.txt | |
# - name: Manage APK files | |
# run: | | |
# mkdir apks | |
# APP_VERSION=$(cat ./VERSION) | |
# mv ./release/app-arm64-v8a-release.apk apks/gi-material-tracker-arm64-$APP_VERSION.apk | |
# mv ./release/app-x86_64-release.apk apks/gi-material-tracker-x64-$APP_VERSION.apk | |
# mv ./release/app-armeabi-v7a-release.apk apks/gi-material-tracker-arm-$APP_VERSION.apk | |
# mv ./app-fatapk.apk apks/gi-material-tracker-multiarch-$APP_VERSION.apk | |
# mv ./release/app.ipa apks/gi-material-tracker-ios-$APP_VERSION.ipa | |
# - uses: olegtarasov/[email protected] | |
# id: tagName | |
# - name: Generating Releases to deploy tagged version of app | |
# uses: softprops/action-gh-release@v1 | |
# with: | |
# generate_release_notes: true | |
# body_path: release-beta.txt | |
# name: Release ${{ steps.tagName.outputs.tag }} | |
# draft: false | |
# prerelease: false | |
# files: | | |
# apks/*.apk | |
# apks/*.ipa | |
# releaseipa: | |
# runs-on: macos-12 # Use macOS 12 for Xcode 13 | |
# name: Generate Release Flutter Unsigned IPA | |
# env: | |
# APP_BUILD_VER: beta | |
# APP_TYPE: iOS | |
# steps: | |
# - uses: actions/checkout@v3 | |
# with: | |
# fetch-depth: 0 | |
# # - uses: apple-actions/import-codesign-certs@v1 | |
# # name: Import Apple Certificate | |
# # with: | |
# # p12-file-base64: ${{ secrets.APPLE_DEVCERT }} | |
# # p12-password: ${{ secrets.APPLE_DEVCERT_PASSWORD }} | |
# - name: Install Flutter Stable | |
# uses: subosito/[email protected] | |
# with: | |
# channel: 'stable' | |
# cache: true | |
# - name: Use latest stable version of XCode | |
# uses: maxim-lobanov/setup-xcode@v1 | |
# with: | |
# xcode-version: latest-stable | |
# - name: Cache pubspec dependencies | |
# uses: actions/cache@v3 | |
# with: | |
# path: | | |
# ${{ env.FLUTTER_HOME }}/.pub-cache | |
# ${{ env.PUB_CACHE }} | |
# **/.packages | |
# **/.flutter-plugins | |
# **/.flutter-plugin-dependencies | |
# **/.dart_tool/package_config.json | |
# key: build-pubspec-${{ hashFiles('**/pubspec.lock') }} | |
# restore-keys: build-pubspec- | |
# - name: Cache Cocoapods | |
# uses: actions/cache@v3 | |
# with: | |
# path: ios/Pods | |
# key: ${{ runner.os }}-pods-${{ hashFiles('ios/**/Podfile.lock') }} | |
# restore-keys: ${{ runner.os }}-pods- | |
# - name: Trust GitHub Workspace | |
# run: git config --global --add safe.directory "$GITHUB_WORKSPACE" | |
# - name: Test Flutter Doctor | |
# run: flutter doctor -v | |
# - uses: benjlevesque/[email protected] | |
# id: short-sha | |
# with: | |
# length: 8 | |
# - name: Pre-Setup and obtain version information | |
# run: | | |
# mkdir release | |
# export GIT_COMMIT_COUNT="$(git rev-list --count HEAD)" | |
# echo $GIT_COMMIT_COUNT | |
# echo $GIT_COMMIT_SHORT_SHA | |
# chmod +x ./ciscripts/get_version.sh | |
# ./ciscripts/get_version.sh | |
# env: | |
# CI_COMMIT_SHORT_SHA: ${{ steps.short-sha.outputs.sha }} | |
# - name: Install Flutter dependencies | |
# run: flutter pub get | |
# - name: Install CocoaPods Dependencies | |
# working-directory: ios | |
# run: | | |
# pod repo update | |
# pod install | |
# - name: Retrieve Firebase Options Dart files and decode to file | |
# env: | |
# GOOGLE_SVC_IOS: ${{ secrets.GOOGLE_SVC_IOS }} | |
# GOOGLE_SVC_DART: ${{ secrets.GOOGLE_SVC_DART }} | |
# PUB_SEC_DART: ${{ secrets.PUB_SEC_DART }} | |
# run: | | |
# echo $GOOGLE_SVC_IOS | base64 -d > ios/Runner/GoogleService-Info.plist | |
# echo $GOOGLE_SVC_DART | base64 -d > lib/firebase_options.dart | |
# echo $PUB_SEC_DART | base64 -d > lib/app_secrets.dart | |
# - name: Build iOS Package | |
# run: flutter build ios --release --no-codesign | |
# - name: Move Package to Release folder | |
# run: mv ./build/ios/iphoneos/Runner.app ./release | |
# - name: Generate IPA File | |
# run: | | |
# cd release | |
# mkdir Payload | |
# cp -r ./Runner.app Payload | |
# zip -r app.ipa Payload | |
# cd .. | |
# - name: Ensure IPA file generated properly | |
# run: | | |
# cd release | |
# ls -lh . | |
# cd .. | |
# - uses: actions/upload-artifact@v3 | |
# with: | |
# name: flutter-unsigned-ipa-artifact-rel | |
# path: | | |
# release/app.ipa |