Skip to content

Commit

Permalink
new workflow for internal version
Browse files Browse the repository at this point in the history
  • Loading branch information
quetool committed Feb 23, 2024
1 parent 497e0f5 commit cb0ac5f
Show file tree
Hide file tree
Showing 4 changed files with 139 additions and 4 deletions.
115 changes: 115 additions & 0 deletions .github/workflows/build-android-debug.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
name: Build Android App Debug (alpha)

on: workflow_dispatch
# release:
# types: [ published ]

jobs:
build_with_signing:
runs-on: macos-latest

steps:
# Checkout the repo
- name: Checkout repository
uses: actions/checkout@v4
- name: Create temp firebase key
env:
FIREBASE_KEY_BASE64: ${{ secrets.FIREBASE_KEY_BASE64 }}
run: |
# create variables
FIREBASE_KEY_PATH=$RUNNER_TEMP/flutter-c7c2c-6df892fe6ddb.json
# import certificate and provisioning profile from secrets
echo -n "$FIREBASE_KEY_BASE64" | base64 --decode -o $FIREBASE_KEY_PATH
# Setup Java 11
- name: Setup Java 17
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '17'
architecture: x86_64
cache: 'gradle'
- name: Cache Gradle
uses: actions/cache@v3
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
# Install Flutter SDK
- name: Install Flutter
uses: subosito/flutter-action@v2
with:
channel: "stable"
architecture: x64
# Get package dependencies and generate files
- name: Get package dependencies and generate files
run: |
flutter pub get
flutter pub run build_runner build --delete-conflicting-outputs
# Get example app dependencies and generate files
- name: Get example app dependencies and generate files
working-directory: example
run: |
flutter pub get
flutter pub run build_runner build --delete-conflicting-outputs
# Build Android example app
- name: Build Android APK
working-directory: example
env:
PROJECT_ID: ${{ secrets.PROJECT_ID }}
run: |
# Get app version from file
GRADLE_FILE=android/gradle.properties
VERSION_FILE=$GITHUB_WORKSPACE/lib/version.dart
VERSION=`echo $(cat $VERSION_FILE) | sed "s/[^']*'\([^']*\)'.*/\1/"`
# Set versionName on gradle.properties
awk -F"=" -v newval="$VERSION" 'BEGIN{OFS=FS} $1=="versionName"{$2=newval}1' $GRADLE_FILE > "$GRADLE_FILE.tmp" && mv "$GRADLE_FILE.tmp" $GRADLE_FILE
# Increment versionCode (build number) on gradle.properties
awk -F"=" 'BEGIN{OFS=FS} $1=="versionCode"{$2=$2+1}1' $GRADLE_FILE > "$GRADLE_FILE.tmp" && mv "$GRADLE_FILE.tmp" $GRADLE_FILE
# Get new versionCode
NEXT_BUILD=$(grep 'versionCode' $GRADLE_FILE | cut -d'=' -f2)
# Build Android app with flutter
flutter build apk --build-name $VERSION --build-number $NEXT_BUILD --dart-define="PROJECT_ID=$PROJECT_ID" --release --flavor alpha
# Setup Node
- name: Setup Node
uses: actions/setup-node@v3
# Setup Firebase
- name: Setup Firebase
uses: w9jds/setup-firebase@main
with:
tools-version: 13.0.1
firebase_token: ${{ secrets.FIREBASE_TOKEN }}
- name: Upload APK
working-directory: example/build/app/outputs/flutter-apk
env:
APP_ID: ${{ secrets.ANDROID_APP_ID }}
run: |
firebase appdistribution:distribute app-release.apk --app $APP_ID --release-notes "Web3Modal Flutter beta testing" --groups flutter-team
- name: Notify Channel
uses: slackapi/[email protected]
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
SLACK_WEBHOOK_TYPE: 'INCOMING_WEBHOOK'
with:
payload: |-
{
"text":"New Android Example app for Web3Modal Flutter ${{ github.event.release.name }} was just deployed."
}
# Clean up Flutter envs
- name: Clean up
if: ${{ always() }}
run: |
rm $RUNNER_TEMP/flutter-c7c2c-6df892fe6ddb.json
flutter clean
cd example
flutter clean
2 changes: 1 addition & 1 deletion .github/workflows/build-android.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build Android App
name: Build Android App Release

on:
workflow_dispatch:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build iOS App Internal
name: Build iOS App Debug (alpha)

on: workflow_dispatch
# release:
Expand Down Expand Up @@ -116,7 +116,7 @@ jobs:
with:
payload: |-
{
"text":"New iOS ALPHA VERSION for Web3Modal Flutter ${{ github.event.release.name }} was just deployed."
"text":"New iOS *ALPHA* version for Web3Modal Flutter ${{ github.event.release.name }} was just deployed."
}
# Clean up
- name: Clean up
Expand Down
22 changes: 21 additions & 1 deletion example/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ android {
}

defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
// Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.web3modal.flutterExample"
// You can update the following values to match your application needs.
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
Expand All @@ -54,6 +54,26 @@ android {
versionName flutterVersionName
}

// Specifies one flavor dimension.
flavorDimensions = ["version"]

productFlavors {
alpha {
// Assigns this product flavor to the "version" flavor dimension.
// If you are using only one dimension, this property is optional,
// and the plugin automatically assigns all the module's flavors to
// that dimension.
dimension "version"
applicationIdSuffix ".debug"
versionNameSuffix "-alpha"
}
beta {
dimension "version"
applicationIdSuffix ".internal"
versionNameSuffix "-beta"
}
}

buildTypes {
release {
// TODO: Add your own signing config for the release build.
Expand Down

0 comments on commit cb0ac5f

Please sign in to comment.