Skip to content

Commit

Permalink
Merge branch 'main' into frepe/barista-hub
Browse files Browse the repository at this point in the history
  • Loading branch information
marfavi authored Nov 9, 2023
2 parents 7db94a9 + 14d5cff commit 32d8d00
Show file tree
Hide file tree
Showing 7 changed files with 61 additions and 53 deletions.
34 changes: 23 additions & 11 deletions .github/actions/build_android/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,12 @@ inputs:
store_artifacts:
required: false
description: "Store artifact"
prod_release:
required: true
description: "Is prod release"
build_type:
required: false
default: "dev"
options:
- dev
- prod

runs:
using: "composite"
Expand All @@ -28,25 +31,34 @@ runs:
with:
prod_release: ${{ inputs.prod_release }}

- name: Build appbundle (dev)
if: ${{ inputs.prod_release != 'true' }}
- name: Build apk (dev)
if: ${{ inputs.build_type == 'dev' }}
run: |
flutter build appbundle --flavor development --release --build-name ${{ inputs.version }} --build-number ${{ inputs.build_version }} --target lib/main_development.dart
mv build/app/outputs/bundle/developmentRelease/app-development-release.aab android.aab
flutter build apk --flavor development --release --build-name ${{ inputs.version }} --build-number ${{ inputs.build_version }} --target lib/main_development.dart
mv build/app/outputs/flutter-apk/app-development-release.apk android.apk
shell: bash

- name: Upload apk (dev)
if: ${{ !!inputs.store_artifacts && inputs.build_type == 'dev'}}
uses: actions/[email protected]
with:
name: android
path: android.apk
retention-days: 1
if-no-files-found: error

- name: Build appbundle (prod)
if: ${{ inputs.prod_release == 'true' }}
if: ${{ inputs.build_type == 'prod' }}
run: |
flutter build appbundle --flavor production --release --build-name ${{ inputs.version }} --build-number ${{ inputs.build_version }} --target lib/main_production.dart
mv build/app/outputs/bundle/productionRelease/app-production-release.aab android.aab
shell: bash

- name: Upload Android build
if: ${{ !!inputs.store_artifacts }}
- name: Upload appbundle (prod)
if: ${{ !!inputs.store_artifacts && inputs.build_type == 'prod'}}
uses: actions/[email protected]
with:
name: android
path: android.aab
retention-days: 1
if-no-files-found: error
if-no-files-found: error
39 changes: 21 additions & 18 deletions .github/actions/build_ios/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,29 @@ inputs:
required: true
description: "App version"
build_version:
required: true
description: "Build version"
required: true
description: "Build version"
apple_ios_signing_cert:
required: true
description: "iOS signing certificate"
required: true
description: "iOS signing certificate"
apple_ios_signing_cert_pw:
required: true
description: "iOS signing certificate password base 64 encoded"
required: true
description: "iOS signing certificate password base 64 encoded"
apple_ios_provisioning_profile:
required: true
description: "Provisioning profile"
required: true
description: "Provisioning profile"
apple_keychain_pw:
required: true
description: "Keychain password"
required: true
description: "Keychain password"
store_artifacts:
required: true
description: "Store artifact"
prod_release:
required: true
description: "Is prod release"
required: true
description: "Store artifact"
build_type:
required: false
default: "dev"
options:
- dev
- prod

runs:
using: "composite"
Expand All @@ -42,15 +45,15 @@ runs:
- name: Setup Flutter environment
uses: ./.github/actions/setup_flutter_environment
with:
prod_release: ${{ inputs.prod_release }}
prod_release: ${{ inputs.build_type == 'prod' }}

- name: Build iOS (dev)
if: ${{ inputs.prod_release != 'true' }}
if: ${{ inputs.build_type != 'prod' }}
run: .github/scripts/build_ios_dev.sh ${{ inputs.version }} ${{ inputs.build_version }}
shell: bash

- name: Build iOS (prod)
if: ${{ inputs.prod_release == 'true' }}
if: ${{ inputs.build_type == 'prod' }}
run: .github/scripts/build_ios_prod.sh ${{ inputs.version }} ${{ inputs.build_version }}
shell: bash

Expand Down
28 changes: 11 additions & 17 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
name: Build application

on:
pull_request:
branches: [ main ]

workflow_dispatch:

workflow_call:
Expand All @@ -12,16 +9,13 @@ on:
type: boolean
required: false
default: false
prod_release:
type: boolean
required: false
tag_name:
type: string
required: true
build_type:
type: string
required: false

env:
PROD_RELEASE: ${{ inputs.prod_release || 'false' }}
TAG_NAME: ${{ inputs.tag_name || 'dev' }}
default: "dev"

jobs:
version:
Expand All @@ -42,11 +36,11 @@ jobs:
echo "Version: $VERSION"
echo "Run No: $BUILD_NO"
env:
VERSION: ${{ env.TAG_NAME }}
VERSION: ${{ inputs.TAG_NAME }}
BUILD_NO: ${{ steps.build_version.outputs.build_no }}

outputs:
version: ${{ env.TAG_NAME }}
version: ${{ inputs.TAG_NAME }}
build_version: ${{ steps.build_version.outputs.build_no }}

build_ios:
Expand All @@ -58,7 +52,7 @@ jobs:
uses: actions/[email protected]

- name: Build iOS app (dev)
if: ${{ env.PROD_RELEASE != 'true' }}
if: ${{ inputs.build_type != 'prod' }}
uses: ./.github/actions/build_ios
with:
version: ${{ needs.version.outputs.version }}
Expand All @@ -68,10 +62,10 @@ jobs:
apple_ios_provisioning_profile: ${{ secrets.APPLE_IOS_PROVISIONING_PROFILE_DEVELOPMENT }}
apple_keychain_pw: ${{ secrets.APPLE_KEYCHAIN_PW }}
store_artifacts: ${{ inputs.store_artifacts }}
prod_release: ${{ env.PROD_RELEASE }}
build_type: ${{ inputs.build_type }}

- name: Build iOS app (prod)
if: ${{ env.PROD_RELEASE == 'true' }}
if: ${{ inputs.build_type == 'prod' }}
uses: ./.github/actions/build_ios
with:
version: ${{ needs.version.outputs.version }}
Expand All @@ -81,7 +75,7 @@ jobs:
apple_ios_provisioning_profile: ${{ secrets.APPLE_IOS_PROVISIONING_PROFILE_PROD }}
apple_keychain_pw: ${{ secrets.APPLE_KEYCHAIN_PW }}
store_artifacts: ${{ inputs.store_artifacts }}
prod_release: ${{ env.PROD_RELEASE }}
build_type: ${{ inputs.build_type }}

build_android:
name: Build Android App
Expand All @@ -97,4 +91,4 @@ jobs:
version: ${{ needs.version.outputs.version }}
build_version: ${{ needs.version.outputs.build_version }}
store_artifacts: ${{ inputs.store_artifacts }}
prod_release: ${{ env.PROD_RELEASE }}
build_type: ${{ inputs.build_type }}
7 changes: 4 additions & 3 deletions .github/workflows/release-dev.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
name: Publish Development App

on:
push:
pull_request:
branches: [ main ]

jobs:
build:
uses: ./.github/workflows/build.yml
with:
store_artifacts: true
prod_release: false
build_type: "dev"
tag_name: ${{ github.head_ref }}
secrets: inherit

test:
Expand Down Expand Up @@ -55,4 +56,4 @@ jobs:
# FIXME: token is deprecated, use serviceCredentialsFileContent instead
# serviceCredentialsFileContent: ${{ secrets.CREDENTIAL_FILE_CONTENT }}
groups: analogio-devs
file: android.aab
file: android.apk
2 changes: 1 addition & 1 deletion .github/workflows/release-prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
uses: ./.github/workflows/build.yml
with:
store_artifacts: true
prod_release: true
build_type: "prod"
tag_name: ${{ github.event.release.tag_name }}
secrets: inherit

Expand Down
2 changes: 0 additions & 2 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -70,15 +70,13 @@ android {
development {
dimension "app"
applicationId "dk.analogio.analog.dev"
versionNameSuffix "-dev"
resValue "string", "app_name", "[DEV] Analog"
resValue "string", "app_deep_link", "analogcoffeecard-dev"
}
production {
dimension "app"
applicationId "dk.analog.digitalclipcard"
applicationIdSuffix ""
versionNameSuffix "-prod"
resValue "string", "app_name", "Analog"
resValue "string", "app_deep_link", "analogcoffeecard"
}
Expand Down
2 changes: 1 addition & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ buildscript {
}

dependencies {
classpath 'com.android.tools.build:gradle:8.1.1'
classpath 'com.android.tools.build:gradle:8.1.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.gms:google-services:4.3.14'
classpath 'com.google.firebase:perf-plugin:1.4.1'
Expand Down

0 comments on commit 32d8d00

Please sign in to comment.