这是indexloc提供的服务,不要输入任何密码
Skip to content

chore: releases

chore: releases #1749

Workflow file for this run

name: Flipper - CI/CD - Windows & Android & Google Play
on:
# Enable manual run
workflow_dispatch:
inputs:
lane:
description: "Fastlane lane"
required: true
default: "internal"
type: choice
options:
- beta
- promote_to_production
- production
push:
branches:
- 'feature-*'
- 'hotfix-*'
- 'bugfix-*'
- main
- dev
- end-user-facing
- shifts
- mislenous-post-mondy-merge
env:
URL: ${{ secrets.DB_URL }}
PASSWORD: ${{ secrets.DB_PASSWORD }}
SHOREBIRD_TOKEN: ${{ secrets.SHOREBIRD_TOKEN }}
# SUPABASE_SERVICE_ROLE_KEY: ${{ secrets.SUPABASE_SERVICE_ROLE_KEY }} # Securely store this
IS_TEST_ENV: true
jobs:
unit-testing:
name: Unit Testing
runs-on: ubuntu-latest
# needs: [supabase-init] # Requires Supabase to be initialized
steps:
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
with:
submodules: recursive
token: ${{ secrets.ACCESS_TOKEN }}
persist-credentials: true
- name: Force submodule update
run: git submodule update --init --force --recursive
- uses: actions/setup-java@v4
with:
distribution: "zulu"
java-version: "17"
- uses: subosito/flutter-action@v2
with:
flutter-version: "3.35.7"
channel: "stable"
- run: |
git submodule update --init
- name: Load melos
run: |
dart pub global activate melos 6.3.2
melos bootstrap
melos run generate:icons
- name: Configure Missing files
shell: bash
run: |
echo "$INDEX" >> apps/flipper/web/index.html
echo "$CONFIGDART" >> packages/flipper_login/lib/config.dart
echo "$SECRETS" >> packages/flipper_models/lib/secrets.dart
echo "$SECRETS" >> apps/flipper_web/lib/core/secrets.dart
echo "$FIREBASEOPTIONS" >> apps/flipper/lib/firebase_options.dart
echo "$FIREBASEOPTIONS" >> packages/flipper_models/lib/firebase_options.dart
echo "$AMPLIFY_CONFIG" >> apps/flipper/lib/amplifyconfiguration.dart
echo "$AMPLIFY_TEAM_PROVIDER" >> apps/flipper/amplify/team-provider-info.json
git config --global core.autocrlf false
echo "$AMPLIFY_TEAM_PROVIDER" >> apps/flipper/amplify/team-provider-info.json
env:
INDEX: ${{ secrets.INDEX }}
CONFIGDART: ${{ secrets.CONFIGDART }}
SECRETS: ${{ secrets.SECRETS }}
FIREBASEOPTIONS: ${{ secrets.FIREBASEOPTIONS }}
AMPLIFY_CONFIG: ${{ secrets.AMPLIFY_CONFIG }}
AMPLIFY_TEAM_PROVIDER: ${{ secrets.AMPLIFY_TEAM_PROVIDER }}
- name: Install LCOV
run: sudo apt-get update && sudo apt-get install -y lcov
- name: Run tests with coverage
run: |
cd packages/flipper_dashboard
cd ../..
melos run test:ci
# # dart run realm install
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
directory: packages/flipper_dashboard/coverage
build_web_deploy_firebase:
runs-on: ubuntu-latest
needs: [unit-testing]
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: recursive
token: ${{ secrets.ACCESS_TOKEN }}
persist-credentials: true
- name: Force submodule update
run: git submodule update --init --force --recursive
# Setup Flutter (No changes needed here)
- name: Clone Flutter repository with stable channel
uses: subosito/flutter-action@v2
with:
flutter-version: "3.35.7" # Consider using a more recent stable Flutter version if possible/needed
channel: stable
- run: flutter doctor -v
# Git initialization and submodule handling (No changes needed here)
- name: Initialize Git repository
run: git init
- name: Submodule init and update
run: git submodule update --init
# Configure secrets (No changes needed here)
- name: Configure Missing files
shell: bash
run: |
echo "$CONFIGDART" >> packages/flipper_login/lib/config.dart
echo "$SECRETS" >> packages/flipper_models/lib/secrets.dart
echo "$SECRETS" >> apps/flipper_web/lib/core/secrets.dart
echo "$FIREBASEOPTIONS" >> apps/flipper/lib/firebase_options.dart
echo "$FIREBASEOPTIONS" >> packages/flipper_models/lib/firebase_options.dart
echo "$AMPLIFY_CONFIG" >> apps/flipper/lib/amplifyconfiguration.dart
echo "$AMPLIFY_TEAM_PROVIDER" >> apps/flipper/amplify/team-provider-info.json
env:
INDEX: ${{ secrets.INDEX }}
CONFIGDART: ${{ secrets.CONFIGDART }}
SECRETS: ${{ secrets.SECRETS }}
FIREBASEOPTIONS: ${{ secrets.FIREBASEOPTIONS }}
AMPLIFY_CONFIG: ${{ secrets.AMPLIFY_CONFIG }}
AMPLIFY_TEAM_PROVIDER: ${{ secrets.AMPLIFY_TEAM_PROVIDER }}
- name: Set up Node.js for Firebase CLI
uses: actions/setup-node@v4
with:
node-version: '20' # Specify Node.js v20.x LTS
- name: Bootstrap dependencies
run: |
dart pub global activate melos 6.3.2
melos bootstrap
- name: Build Flipper app
run: |
cd apps/flipper
flutter build web --release # Added --release flag for production builds
- name: Deploy Flipper app to Firebase Hosting
id: deploy_flipper
uses: FirebaseExtended/action-hosting-deploy@v0.9.0 # Consider using @v0 for latest fixes if needed
with:
entryPoint: apps/flipper # This should point to the directory containing firebase.json and the build output (usually build/web within the app)
repoToken: ${{ secrets.GITHUB_TOKEN }}
firebaseServiceAccount: ${{ secrets.FIREBASE_SERVICE_ACCOUNT_YEGOBOX_2EE43 }}
channelId: pr-${{ github.event.commits.id }}
# channelId: live
projectId: yegobox-2ee43
- name: Echo Flipper URL
run: echo "Flipper app deployed to ${{ steps.deploy_flipper.outputs.urls }}"
- name: Build Flipper Web app
run: |
cd apps/flipper_web
flutter build web --release
- name: Deploy Flipper Web app to Firebase Hosting
id: deploy_flipper_web
uses: FirebaseExtended/action-hosting-deploy@v0.9.0
with:
entryPoint: apps/flipper_web
repoToken: ${{ secrets.GITHUB_TOKEN }}
firebaseServiceAccount: ${{ secrets.FIREBASE_SERVICE_ACCOUNT_YEGOBOX_2EE43 }}
channelId: pr-${{ github.event.commits.id }}
# channelId: live
projectId: yegobox-2ee43
- name: Echo Flipper Web URL
run: echo "Flipper Web app deployed to ${{ steps.deploy_flipper_web.outputs.urls }}"
integration-testing-windows:
name: "Integration Testing Windows"
runs-on: windows-2022
# if: false # skip for now as it is flaky
needs: [unit-testing,build_web_deploy_firebase] # Requires Supabase to be initialized
steps:
- name: Export pub environment variable on Windows
run: |
if [ "$RUNNER_OS" == "Windows" ]; then
echo "PUB_CACHE=$LOCALAPPDATA\\Pub\\Cache" >> $GITHUB_ENV
fi
shell: bash
- run: git config --global core.autocrlf false
- uses: actions/checkout@v4
with:
submodules: recursive
token: ${{ secrets.ACCESS_TOKEN }}
persist-credentials: true
- name: Force submodule update
run: git submodule update --init --force --recursive
- name: Clone Flutter repository with stable channel
uses: subosito/flutter-action@v2
with:
flutter-version: "3.35.7"
channel: stable
- run: flutter doctor -v
- uses: actions/setup-java@v4
with:
distribution: "zulu"
java-version: "17"
- name: submodule init
run: |
git submodule update --init
dart pub global activate melos 6.3.2
melos bootstrap
- name: Configure Missing files
shell: bash
run: |
echo "$INDEX" >> apps/flipper/web/index.html
echo "$CONFIGDART" >> packages/flipper_login/lib/config.dart
echo "$SECRETS" >> packages/flipper_models/lib/secrets.dart
echo "$SECRETS" >> apps/flipper_web/lib/core/secrets.dart
echo "$FIREBASEOPTIONS" >> apps/flipper/lib/firebase_options.dart
echo "$FIREBASEOPTIONS" >> packages/flipper_models/lib/firebase_options.dart
echo "$AMPLIFY_CONFIG" >> apps/flipper/lib/amplifyconfiguration.dart
echo "$AMPLIFY_TEAM_PROVIDER" >> apps/flipper/amplify/team-provider-info.json
env:
INDEX: ${{ secrets.INDEX }}
CONFIGDART: ${{ secrets.CONFIGDART }}
SECRETS: ${{ secrets.SECRETS }}
FIREBASEOPTIONS: ${{ secrets.FIREBASEOPTIONS }}
AMPLIFY_CONFIG: ${{ secrets.AMPLIFY_CONFIG }}
AMPLIFY_TEAM_PROVIDER: ${{ secrets.AMPLIFY_TEAM_PROVIDER }}
- run: |
cd apps/flipper
flutter test --dart-define=FLUTTER_TEST_ENV=true -d windows integration_test/smoke_windows_test.dart
build-and-release-windows-debug:
name: "Build windows app-debug"
# if: false # skip for now as it is flaky
runs-on: windows-latest
# needs: [unit-testing,build_web_deploy_firebase] # Requires Supabase to be initialized
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
token: ${{ secrets.ACCESS_TOKEN }} # Use a token with repo scope for releases
persist-credentials: true
- name: Force submodule update
run: git submodule update --init --force --recursive
- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: "3.35.7"
channel: stable
cache: true
- name: Setup melos
run: |
dart pub global activate melos 6.3.2
melos bootstrap
- name: Configure Missing files
shell: bash
run: |
echo "$INDEX" >> apps/flipper/web/index.html
echo "$CONFIGDART" >> packages/flipper_login/lib/config.dart
echo "$SECRETS" >> packages/flipper_models/lib/secrets.dart
echo "$SECRETS" >> apps/flipper_web/lib/core/secrets.dart
echo "$FIREBASEOPTIONS" >> apps/flipper/lib/firebase_options.dart
echo "$FIREBASEOPTIONS" >> packages/flipper_models/lib/firebase_options.dart
echo "$AMPLIFY_CONFIG" >> apps/flipper/lib/amplifyconfiguration.dart
echo "$AMPLIFY_TEAM_PROVIDER" >> apps/flipper/amplify/team-provider-info.json
env:
INDEX: ${{ secrets.INDEX }}
CONFIGDART: ${{ secrets.CONFIGDART }}
SECRETS: ${{ secrets.SECRETS }}
FIREBASEOPTIONS: ${{ secrets.FIREBASEOPTIONS }}
AMPLIFY_CONFIG: ${{ secrets.AMPLIFY_CONFIG }}
AMPLIFY_TEAM_PROVIDER: ${{ secrets.AMPLIFY_TEAM_PROVIDER }}
- name: Build and Package
run: |
cd apps/flipper
flutter clean
dart run msix:create -v --install-certificate false --signtool-options "/td SHA256"
- name: Extract msix_version
id: get_version
shell: powershell
run: |
$MSIX_VERSION = (Get-Content -Path "apps/flipper/pubspec.yaml" -Raw) -match 'msix_config:\s*([\s\S]*?)\bmsix_version:\s*(\d+\.\d+\.\d+\.\d+)\b' | ForEach-Object { if ($matches.Count -ge 2) { $matches[2] } else { Write-Output "No msix_version found"; exit 1 } }; echo "version=$MSIX_VERSION" >> $env:GITHUB_OUTPUT
- name: Create Debug Release
uses: softprops/action-gh-release@v1
with:
files: apps/flipper/build/windows/x64/runner/Release/flipper_rw.msix
tag_name: v${{ steps.get_version.outputs.version }}_windows_debug
name: Windows Debug Release ${{ steps.get_version.outputs.version }}
draft: false
body: |
Debug Release for QA
env:
GITHUB_TOKEN: ${{ github.token }}
build-and-release-windows-prod:
name: "Build windows app-store"
if: github.ref == 'refs/heads/main'
runs-on: windows-latest
needs: [unit-testing, integration-testing-windows,build_web_deploy_firebase] # Requires Supabase to be initialized
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
token: ${{ secrets.ACCESS_TOKEN }} # Use a PAT
persist-credentials: true # Keep this for checkout
- name: Force submodule update
run: git submodule update --init --force --recursive
- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: "3.35.7"
channel: stable
cache: true
- name: Initialize submodules
run: git submodule update --init
- name: Setup melos
run: |
dart pub global activate melos 6.3.2
melos bootstrap
- name: Configure Missing files
shell: bash
run: |
echo "$INDEX" >> apps/flipper/web/index.html
echo "$CONFIGDART" >> packages/flipper_login/lib/config.dart
echo "$SECRETS" >> packages/flipper_models/lib/secrets.dart
echo "$SECRETS" >> apps/flipper_web/lib/core/secrets.dart
echo "$FIREBASEOPTIONS" >> apps/flipper/lib/firebase_options.dart
echo "$FIREBASEOPTIONS" >> packages/flipper_models/lib/firebase_options.dart
echo "$AMPLIFY_CONFIG" >> apps/flipper/lib/amplifyconfiguration.dart
echo "$AMPLIFY_TEAM_PROVIDER" >> apps/flipper/amplify/team-provider-info.json
env:
INDEX: ${{ secrets.INDEX }}
CONFIGDART: ${{ secrets.CONFIGDART }}
SECRETS: ${{ secrets.SECRETS }}
FIREBASEOPTIONS: ${{ secrets.FIREBASEOPTIONS }}
AMPLIFY_CONFIG: ${{ secrets.AMPLIFY_CONFIG }}
AMPLIFY_TEAM_PROVIDER: ${{ secrets.AMPLIFY_TEAM_PROVIDER }}
- name: Build and Package
run: |
cd apps/flipper
flutter clean
dart run msix:create --store
- name: Extract msix_version
id: get_version
shell: powershell
run: |
$MSIX_VERSION = (Get-Content -Path "apps/flipper/pubspec.yaml" -Raw) -match 'msix_config:\s*([\s\S]*?)\bmsix_version:\s*(\d+\.\d+\.\d+\.\d+)\b' | ForEach-Object { if ($matches.Count -ge 2) { $matches[2] } else { Write-Output "No msix_version found"; exit 1 } }; echo "version=$MSIX_VERSION" >> $env:GITHUB_OUTPUT
- name: Create Production Release
uses: softprops/action-gh-release@v1
with:
files: apps/flipper/build/windows/x64/runner/Release/flipper_rw.msix
tag_name: v${{ steps.get_version.outputs.version }}_windows_prod
name: Windows Production Release ${{ steps.get_version.outputs.version }}
draft: false
body: |
Production Release for Windows App Store
env:
GITHUB_TOKEN: ${{ github.token }} # Use the default GITHUB_TOKEN
fastlane-deploy:
name: "Google Deploy ${{ matrix.app }}"
if: github.ref != 'refs/heads/main' # Skip this job on main branch
runs-on: ubuntu-latest
continue-on-error: true
strategy:
fail-fast: false
matrix:
app: [flipper, flipper_auth]
steps:
- name: Free Disk Space
uses: jlumbroso/free-disk-space@main
with:
tool-cache: true
android: false
dotnet: true
haskell: true
large-packages: true
docker-images: true
swap-storage: true
- run: git config --global core.autocrlf false
# Set up Flutter.
- name: Clone Flutter repository with stable channel
uses: subosito/flutter-action@v2
with:
flutter-version: "3.35.7" #firebase_auth_desktop is broken with 3.10.6
channel: stable
- run: flutter doctor -v
# Checkout flipper code
- name: Checkout flipper code
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9
with:
submodules: recursive
token: ${{ secrets.ACCESS_TOKEN }}
persist-credentials: true
- name: Force submodule update
run: git submodule update --init --force --recursive
- uses: actions/setup-java@v4 #plugin for setting up the java
with:
distribution: "zulu"
java-version: "17" #defines the java version
- name: Accept Android licenses
run: |
yes | $ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager --licenses
yes | $ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager "ndk;28.0.12674087"
- name: Configure Git with PAT
env:
PAT_TOKEN: ${{ secrets.PAT_TOKEN }}
run: |
git config --global user.email "info@yegobox.com"
git config --global user.name "YEGOBOX"
git config --global credential.helper store
echo "https://github.com:${PAT_TOKEN}@github.com" > ~/.git-credentials
- name: Initialize submodules
run: git submodule update --init
- name: Setup melos
run: |
dart pub global activate melos 6.3.2
melos bootstrap
- name: Configure Missing files
run: |
echo "$INDEX" >> apps/flipper/web/index.html
echo "$CONFIGDART" >> packages/flipper_login/lib/config.dart
echo "$SECRETS" >> packages/flipper_models/lib/secrets.dart
echo "$SECRETS" >> apps/flipper_web/lib/core/secrets.dart
if [ "${{ matrix.app }}" = "flipper_auth" ]; then
echo "$SECRETS" >> apps/flipper_auth/lib/core/secrets.dart
fi
echo "$FIREBASEOPTIONS" >> apps/flipper/lib/firebase_options.dart
echo "$FIREBASEOPTIONS" >> packages/flipper_models/lib/firebase_options.dart
git config --global core.autocrlf false
echo "$AMPLIFY_CONFIG" >> apps/flipper/lib/amplifyconfiguration.dart
echo "$AMPLIFY_TEAM_PROVIDER" >> apps/flipper/amplify/team-provider-info.json
env:
INDEX: ${{ secrets.INDEX }}
CONFIGDART: ${{ secrets.CONFIGDART }}
SECRETS: ${{ secrets.SECRETS }}
FIREBASEOPTIONS: ${{ secrets.FIREBASEOPTIONS }}
AMPLIFY_CONFIG: ${{ secrets.AMPLIFY_CONFIG }}
AMPLIFY_TEAM_PROVIDER: ${{ secrets.AMPLIFY_TEAM_PROVIDER }}
- name: Verify app exists
run: |
echo "Checking if apps/${{ matrix.app }} exists..."
ls -la apps/
ls -la apps/${{ matrix.app }}/
ls -la apps/${{ matrix.app }}/android/
- run: |
dart pub global activate melos 6.3.2
melos bootstrap
# Get version from pubspec.yaml
- name: Get version from pubspec.yaml
id: get_version
run: |
VERSION=$(grep '^version:' apps/${{ matrix.app }}/pubspec.yaml | cut -d ' ' -f 2 | tr -d '\r')
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "Version: $VERSION"
# Setup Ruby, Bundler, and Gemfile dependencies
- name: Setup Fastlane
uses: ruby/setup-ruby@v1
with:
ruby-version: "3.0"
bundler-cache: true
# cache-version: 1
working-directory: apps/${{ matrix.app }}/android
- name: Write Posthog API Key to local.properties
run: |
echo "POSTHOG_API_KEY=${{ secrets.POSTHOG_API_KEY }}" > android/app/local.properties
working-directory: apps/${{ matrix.app }}
- name: Set environment variables
run: |
if [ "${{ matrix.app }}" = "flipper_auth" ]; then
cat << 'ENV_EOF' >> "$GITHUB_ENV"
PLAY_STORE_UPLOAD_KEY<<EOF
${{ secrets.PLAY_STORE_UPLOAD_KEY }}
EOF
KEYSTORE_KEY_ALIAS=${{ secrets.KEYSTORE_KEY_ALIAS }}
KEYSTORE_KEY_PASSWORD=${{ secrets.KEYSTORE_KEY_PASSWORD }}
KEYSTORE_STORE_PASSWORD=${{ secrets.KEYSTORE_STORE_PASSWORD }}
GOOGLE_SERVICE_JSON<<EOF
${{ secrets.FLIPPER_AUTH_GOOGLE_SERVICE_JSON }}
EOF
ENV_EOF
else
cat << 'ENV_EOF' >> "$GITHUB_ENV"
PLAY_STORE_UPLOAD_KEY<<EOF
${{ secrets.PLAY_STORE_UPLOAD_KEY }}
EOF
KEYSTORE_KEY_ALIAS=${{ secrets.KEYSTORE_KEY_ALIAS }}
KEYSTORE_KEY_PASSWORD=${{ secrets.KEYSTORE_KEY_PASSWORD }}
KEYSTORE_STORE_PASSWORD=${{ secrets.KEYSTORE_STORE_PASSWORD }}
GOOGLE_SERVICE_JSON<<EOF
${{ secrets.GOOGLE_SERVICE_JSON }}
EOF
ENV_EOF
fi
- name: Configure Keystore
run: |
echo "$GOOGLE_SERVICE_JSON" > app/google-services.json
echo "$PLAY_STORE_UPLOAD_KEY" | base64 --decode > app/key.jks
echo "storeFile=key.jks" >> key.properties
echo "keyAlias=$KEYSTORE_KEY_ALIAS" >> key.properties
echo "storePassword=$KEYSTORE_STORE_PASSWORD" >> key.properties
echo "keyPassword=$KEYSTORE_KEY_PASSWORD" >> key.properties
working-directory: apps/${{ matrix.app }}/android
- name: Verify package name before upload
run: |
echo "Verifying package name for ${{ matrix.app }}..."
if [ "${{ matrix.app }}" = "flipper_auth" ]; then
expected_package="rw.flipper.auth"
else
expected_package="rw.flipper"
fi
# Extract package name from build.gradle.kts
actual_package=$(grep 'applicationId = ' app/build.gradle.kts | sed 's/.*applicationId = "\(.*\)".*/\1/')
echo "Expected package: $expected_package"
echo "Actual package: $actual_package"
if [ "$actual_package" != "$expected_package" ]; then
echo "ERROR: Package name mismatch!"
exit 1
fi
working-directory: apps/${{ matrix.app }}/android
- run: |
bundle exec fastlane ${{ github.event.inputs.lane || 'internal' }}
env:
PLAY_STORE_CONFIG_JSON: ${{ matrix.app == 'flipper_auth' && secrets.FLIPPER_AUTH_PLAYSTORE_ACCOUNT_KEY || secrets.PLAYSTORE_ACCOUNT_KEY }}
DB_URL: ${{ secrets.DB_URL }}
DB_PASSWORD: ${{ secrets.DB_PASSWORD }}
working-directory: apps/${{ matrix.app }}/android
- name: Upload Android AAB
uses: softprops/action-gh-release@v1
with:
name: ${{ matrix.app }} Android AAB Release - ${{ github.ref_name }}
tag_name: v${{ steps.get_version.outputs.version }}_${{ matrix.app }}
draft: false
body: |
Debug Release for QA
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
slackNotification:
name: Slack Notification
needs: [build-and-release-windows-debug, build-and-release-windows-prod,build_web_deploy_firebase]
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
with:
submodules: recursive
token: ${{ secrets.ACCESS_TOKEN }}
persist-credentials: true
- name: Force submodule update
run: git submodule update --init --force --recursive
- name: Slack Notification
uses: rtCamp/action-slack-notify@v2
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}