-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(ci): development version built in release pipeline (#560)
- Loading branch information
Showing
8 changed files
with
109 additions
and
50 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,12 +10,6 @@ inputs: | |
store_artifacts: | ||
required: false | ||
description: "Store artifact" | ||
build_type: | ||
required: false | ||
default: "dev" | ||
options: | ||
- dev | ||
- prod | ||
signingKeyBase64: | ||
required: true | ||
description: "Android signing key b64" | ||
|
@@ -28,10 +22,23 @@ inputs: | |
keyPassword: | ||
required: true | ||
description: "Android key password" | ||
build_type: | ||
required: true | ||
description: > | ||
Whether to build a development or production version of the app. | ||
A 'development' build connects to the development backend for testing, | ||
while a 'production' build connects to the production backend. | ||
It is an error to specify a build type other than | ||
'development' or 'production'. | ||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Validate build_type | ||
uses: ./.github/actions/verify_build_type | ||
with: | ||
build_type: ${{ inputs.build_type }} | ||
|
||
- name: Setup Java | ||
uses: actions/[email protected] | ||
with: | ||
|
@@ -41,17 +48,17 @@ runs: | |
- name: Setup Flutter environment | ||
uses: ./.github/actions/setup_flutter_environment | ||
with: | ||
prod_release: ${{ inputs.prod_release }} | ||
build_type: ${{ inputs.build_type }} | ||
|
||
- name: Build apk (dev) | ||
if: ${{ inputs.build_type == 'dev' }} | ||
- name: "[dev] Build Android app (apk)" | ||
if: ${{ inputs.build_type == 'development' }} | ||
run: | | ||
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: Build appbundle (prod) | ||
if: ${{ inputs.build_type == 'prod' }} | ||
- name: "[prod] Build Android app (app bundle)" | ||
if: ${{ inputs.build_type == 'production' }} | ||
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 | ||
|
@@ -68,26 +75,26 @@ runs: | |
keyStorePassword: ${{ inputs.keyStorePassword }} | ||
keyPassword: ${{ inputs.keyPassword }} | ||
|
||
- name: Upload appbundle | ||
if: ${{ !!inputs.store_artifacts && inputs.build_type == 'prod'}} | ||
- name: "[prod] Upload app bundle" | ||
if: ${{ !!inputs.store_artifacts && inputs.build_type == 'production'}} | ||
uses: actions/[email protected] | ||
with: | ||
name: android | ||
path: android.aab | ||
retention-days: 1 | ||
if-no-files-found: error | ||
|
||
- name: Move apk | ||
if: ${{ !!inputs.store_artifacts && inputs.build_type != 'prod'}} | ||
- name: "[dev] Move apk file" | ||
if: ${{ !!inputs.store_artifacts && inputs.build_type == 'development'}} | ||
run: | | ||
mv ${{steps.sign_app.outputs.signedReleaseFile}} android.apk | ||
shell: bash | ||
|
||
- name: Upload apk | ||
if: ${{ !!inputs.store_artifacts && inputs.build_type != 'prod'}} | ||
- name: "[dev] Upload apk" | ||
if: ${{ !!inputs.store_artifacts && inputs.build_type == 'development'}} | ||
uses: actions/[email protected] | ||
with: | ||
name: android | ||
path: android.apk | ||
retention-days: 1 | ||
if-no-files-found: error | ||
if-no-files-found: error |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,38 @@ | ||
name: Setup Flutter environment | ||
description: Setup the Flutter environment | ||
inputs: | ||
prod_release: | ||
required: false | ||
default: 'false' | ||
description: "Is prod release" | ||
|
||
env: | ||
FLUTTER_VERSION: 3.13.7 | ||
build_type: | ||
required: true | ||
description: > | ||
Whether to build a development or production version of the app. | ||
A 'development' build connects to the development backend for testing, | ||
while a 'production' build connects to the production backend. | ||
It is an error to specify a build type other than | ||
'development' or 'production'. | ||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Validate build_type | ||
uses: ./.github/actions/verify_build_type | ||
with: | ||
build_type: ${{ inputs.build_type }} | ||
|
||
- name: Setup Flutter environment | ||
uses: subosito/[email protected] | ||
with: | ||
flutter-version: ${{ env.FLUTTER_VERSION }} | ||
flutter-version: 3.16.0 | ||
channel: "stable" | ||
|
||
- name: Download dependencies | ||
run: flutter pub get | ||
shell: bash | ||
|
||
- name: Replace target URI in Production | ||
if: ${{ inputs.prod_release == 'true' }} | ||
- name: "[prod] Change target backend to production" | ||
if: ${{ inputs.build_type == 'production' }} | ||
run: sed -i'' -e 's/.env.develop/.env.production/' lib/env/env.dart | ||
shell: bash | ||
|
||
- name: Generate code | ||
run: dart run build_runner build | ||
shell: bash | ||
shell: bash |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
name: Verify build type | ||
description: Verify that the build type is either 'development' or 'production' | ||
|
||
inputs: | ||
build_type: | ||
required: true | ||
description: > | ||
Whether to build a development or production version of the app. | ||
A 'development' build connects to the development backend for testing, | ||
while a 'production' build connects to the production backend. | ||
It is an error to specify a build type other than | ||
'development' or 'production'. | ||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Validate build_type | ||
run: | | ||
if [[ "${{ inputs.build_type }}" != "development" && "${{ inputs.build_type }}" != "production" ]]; then | ||
echo "Error: build_type must be 'development' or 'production'" | ||
exit 1 | ||
fi | ||
echo "Build type: ${{ inputs.build_type }}" | ||
shell: bash |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,15 +14,28 @@ on: | |
required: true | ||
build_type: | ||
type: string | ||
required: false | ||
default: "dev" | ||
required: true | ||
description: > | ||
Whether to build a development or production version of the app. | ||
A 'development' build connects to the development backend for testing, | ||
while a 'production' build connects to the production backend. | ||
It is an error to specify a build type other than | ||
'development' or 'production'. | ||
jobs: | ||
version: | ||
name: Versioning | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/[email protected] | ||
|
||
- name: Validate build_type | ||
uses: ./.github/actions/verify_build_type | ||
with: | ||
build_type: ${{ inputs.build_type }} | ||
|
||
- name: Determine build version | ||
id: build_version | ||
run: | | ||
|
@@ -51,8 +64,8 @@ jobs: | |
- name: Checkout code | ||
uses: actions/[email protected] | ||
|
||
- name: Build iOS app (dev) | ||
if: ${{ inputs.build_type != 'prod' }} | ||
- name: "[dev] Build iOS app" | ||
if: ${{ inputs.build_type == 'development' }} | ||
uses: ./.github/actions/build_ios | ||
with: | ||
version: ${{ needs.version.outputs.version }} | ||
|
@@ -64,8 +77,8 @@ jobs: | |
store_artifacts: ${{ inputs.store_artifacts }} | ||
build_type: ${{ inputs.build_type }} | ||
|
||
- name: Build iOS app (prod) | ||
if: ${{ inputs.build_type == 'prod' }} | ||
- name: "[prod] Build iOS app" | ||
if: ${{ inputs.build_type == 'production' }} | ||
uses: ./.github/actions/build_ios | ||
with: | ||
version: ${{ needs.version.outputs.version }} | ||
|
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
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
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