Skip to content

Commit

Permalink
Fix app build
Browse files Browse the repository at this point in the history
  • Loading branch information
JElgar committed Sep 16, 2023
1 parent 056dd71 commit 644f286
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 15 deletions.
13 changes: 12 additions & 1 deletion .github/actions/setup-app/action.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
name: 'Setup app'
description: 'Install flutter and dependencies'

inputs:
firebaseConfig:
description: 'Contents of google-services.json'
required: true

runs:
using: "composite"
steps:
Expand All @@ -20,13 +25,19 @@ runs:
channel: 'beta' # 'dev', 'alpha', default to: 'stable'
flutter-version: '3.14.x'
cache: true

- name: Flutter version
shell: bash
run: |
dart --version
flutter --version
- name: Create firebase google-service.json
shell: bash
env:
FIREBASE_CONFIG: ${{ inputs.firebaseConfig }}
run: echo $FIREBASE_CONFIG > ./android/app/google-services.json

- name: Generate openapi client
shell: bash
run: cd openapi && make generate-prod
Expand Down
24 changes: 10 additions & 14 deletions .github/workflows/flutter-ci-cd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,35 +34,29 @@ jobs:
uses: timheuer/base64-to-file@v1
with:
fileName: 'key.jks'
fileDir: './android/app/'
encodedString: ${{ secrets.KEY_JKS_BASE64 }}

- name: Key properties base64 to file
id: write_file_key_properties
uses: timheuer/base64-to-file@v1
uses: timheuer/base64-to-file@v1.2
with:
fileName: 'key.properties'
fileDir: './android/'
encodedString: ${{ secrets.KEY_PROPERTIES_BASE64 }}

- name: Move key.jks and key.properties to proper dir
run: |
mv ${{ steps.write_file_key.outputs.filePath }} ./android/app/
mv ${{ steps.write_file_key_properties.outputs.filePath }} ./android/
- name: Create firebase google-service.json
env:
FIREBASE_CONFIG: ${{ secrets.FIREBASE_CONFIG_PROD }}
run: echo $FIREBASE_CONFIG > ./android/app/google-services.json

# Setup Java environment in order to build the Android app.
- uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
cache: 'gradle'

- name: Setup app
uses: ./.github/actions/setup-app

with:
firebaseConfig: ${{ secrets.FIREBASE_CONFIG_PROD }}

# env:
# ACTIONS_ALLOW_UNSECURE_COMMANDS: 'true'
# env:
Expand All @@ -77,7 +71,7 @@ jobs:
# - run: echo $KEY_JKS > android/key.jks

# Build apk
- run: flutter build appbundle --release
- run: flutter build appbundle --release -v

# Upload generated apk to the artifacts.
- uses: actions/upload-artifact@v1
Expand Down Expand Up @@ -141,6 +135,8 @@ jobs:

- name: Setup app
uses: ./.github/actions/setup-app
with:
firebaseConfig: ${{ secrets.FIREBASE_CONFIG_PROD }}

# Build and sign the ipa using a single flutter command
- name: Building IPA
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/flutter-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ jobs:

- name: Setup app
uses: ./.github/actions/setup-app
with:
firebaseConfig: ${{ secrets.FIREBASE_CONFIG_PROD }}

- run: pod repo update

Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/generate-podfile-lock.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ jobs:
# Checks-out our repository under $GITHUB_WORKSPACE, so our job can access it
- name: Setup app
uses: ./.github/actions/setup-app
with:
firebaseConfig: ${{ secrets.FIREBASE_CONFIG_PROD }}

- run: cd ios && pod install --repo-update

Expand Down

0 comments on commit 644f286

Please sign in to comment.