Linum 1.3.0 (21) #37
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
# Flutter CI CD - GitHub Continuous Integration / Continuous Deployment Action that is triggered when someone tries to merge to release, | |
# which runs all tests, analyzes the code and then signs and deploys for Android and iOS on respective VMs using GitHub Secrets. | |
# | |
# Author: NightmindOfficial | |
# Co-Author: n/a | |
name: Stage | |
on: | |
pull_request: | |
types: [opened, reopened] | |
branches: [staging] | |
workflow_dispatch: | |
env: | |
FLUTTER_CHANNEL: 'stable' # 'stable', 'beta', or 'master', default to: 'stable' | |
XCODE_VERSION: '15.0' | |
PATH_TO_AAB: 'build/app/outputs/bundle/release/app-release.aab' | |
ANDROID_PACKAGE_NAME: 'de.investitacademy.linum' | |
FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }} | |
DOTENV_KEY: ${{ secrets.DOTENV_KEY }} | |
jobs: | |
build-project-artifact: | |
name: Build Project Artifact | |
runs-on: ubuntu-latest | |
timeout-minutes: 30 | |
environment: Staging-Prep | |
steps: | |
- uses: geekyeggo/delete-artifact@v2 | |
with: | |
name: linum-dir-artifact | |
failOnError: false | |
- name: Checkout Repository | |
uses: actions/checkout@v3 | |
- name: Set up Flutter SDK | |
uses: subosito/flutter-action@v2 | |
with: | |
channel: ${{ env.FLUTTER_CHANNEL }} | |
- name: Set up node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 16 | |
- name: Install npm | |
run: npm install | |
- name: Run build file | |
run: npm run build | |
env: | |
DOTENV_KEY: ${{ secrets.DOTENV_KEY }} | |
- name: Prepare Firebase Option Configuration | |
run: | | |
curl -sL https://firebase.tools | bash | |
dart pub global activate flutterfire_cli | |
ls | |
flutterfire --version | |
flutterfire configure -o lib/firebase/firebase_options.g.dart \ | |
-p linum-5d9f6 -y --platforms="android,ios" \ | |
-i de.investitacademy.linum \ | |
-a de.investitacademy.linum \ | |
-w de.investitacademy.linum \ | |
-m de.investitacademy.linum \ | |
--windows-app-id de.investitacademy.linum | |
- name: Upload Artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: linum-dir-artifact | |
path: ./ | |
code-analysis-and-testing: | |
name: Pre-CD Code Analysis and Testing | |
needs: build-project-artifact | |
runs-on: ubuntu-latest | |
timeout-minutes: 30 | |
steps: | |
- name: Download a single artifact | |
uses: actions/download-artifact@v3 | |
with: | |
name: linum-dir-artifact | |
- name: Set up Flutter SDK | |
uses: subosito/flutter-action@v2 | |
with: | |
channel: ${{ env.FLUTTER_CHANNEL }} | |
- name: Analyze Flutter Code | |
run: flutter analyze | |
- name: Flutter Test | |
run: flutter test | |
android: | |
name: Android Beta Deployment | |
needs: code-analysis-and-testing | |
runs-on: ubuntu-latest | |
environment: Staging | |
timeout-minutes: 30 | |
steps: | |
- name: Download a single artifact | |
uses: actions/download-artifact@v3 | |
with: | |
name: linum-dir-artifact | |
- name: Install ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: '3.0' | |
bundler-cache: true | |
- name: Set up Flutter SDK | |
uses: subosito/flutter-action@v2 | |
with: | |
channel: ${{ env.FLUTTER_CHANNEL }} | |
- name: Make script executable | |
run: chmod +x ./android/android_cd.sh | |
- name: Run Android CD script | |
env: | |
KEY_PROPERTIES: ${{ secrets.KEY_PROPERTIES }} | |
ANDROID_SECRET_JSON: ${{ secrets.ANDROID_SECRET_JSON }} | |
KEYSTORE_GPG: ${{ secrets.KEYSTORE_GPG }} | |
KEYSTORE_GPG_PASS: ${{ secrets.KEYSTORE_GPG_PASS }} | |
run: ./android/android_cd.sh $KEY_PROPERTIES $KEYSTORE_GPG $KEYSTORE_GPG_PASS | |
ios: | |
name: iOS Beta Deployment | |
needs: code-analysis-and-testing | |
runs-on: macos-latest | |
environment: Staging | |
timeout-minutes: 70 | |
steps: | |
- name: Download a single artifact | |
uses: actions/download-artifact@v3 | |
with: | |
name: linum-dir-artifact | |
- name: Install ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: '3.0' | |
bundler-cache: true | |
- name: Set up Flutter SDK | |
uses: subosito/flutter-action@v2 | |
with: | |
channel: ${{ env.FLUTTER_CHANNEL }} | |
- id: Auth | |
name: Authenticate to Google Cloud | |
uses: google-github-actions/auth@v1 | |
with: | |
credentials_json: ${{ secrets.GCLOUD_KEY }} | |
# Not sure if needed anymore | |
- name: Set up Cloud SDK | |
uses: google-github-actions/setup-gcloud@v1 | |
- name: Make script executable | |
run: chmod +x ./ios/ios_cd.sh | |
# End of uncertainty | |
- name: Run iOS CD script | |
env: | |
FASTLANE_CERTS_REPO_KEY: ${{ secrets.FASTLANE_CERTS_REPO_KEY }} | |
MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }} | |
MATCH_KEYCHAIN_NAME: ${{ secrets.MATCH_KEYCHAIN_NAME }} | |
MATCH_KEYCHAIN_PASSWORD: ${{ secrets.MATCH_KEYCHAIN_PASSWORD }} | |
run: ./ios/ios_cd.sh | |