Skip to content

Commit

Permalink
[#226] Fix: exporting multi-lines env files using quote "" https://st…
Browse files Browse the repository at this point in the history
  • Loading branch information
luongvo committed Aug 3, 2023
1 parent a631178 commit 5391b6b
Show file tree
Hide file tree
Showing 11 changed files with 37 additions and 27 deletions.
2 changes: 1 addition & 1 deletion .github/wiki/Deployment.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
- A new app on Play Store.

- Add these variables as the secrets of CI:
- **ENV_PRODUCTION**: the production .env configuration file content.
- **ENV**: the production .env configuration file content.
- **GOOGLE_PLAY_SERVICE_ACCOUNT_JSON**: the json file content of the Play Store's Service Account for app publishing. Please check out [how to create the Service Account](https://support.staffbase.com/hc/en-us/articles/360018569579-Preparing-Automated-Publishing-for-Google-Play-Store).

### Resources
Expand Down
7 changes: 4 additions & 3 deletions .github/workflows/android_deploy_production.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ jobs:
build_and_deploy_android:
name: Build & Deploy Android
runs-on: ubuntu-latest
environment: production
timeout-minutes: 30
steps:
- name: Check out
Expand Down Expand Up @@ -43,9 +44,9 @@ jobs:

- name: Set up .env
env:
ENV_PRODUCTION: ${{ secrets.ENV_PRODUCTION }}
ENV: ${{ secrets.ENV }}
run: |
echo $ENV_PRODUCTION > .env
echo "$ENV" > .env
# App Bundle requires Firebase connected to Play Store to upload https://appdistribution.page.link/KPoa
- name: Build Android apk
Expand All @@ -54,7 +55,7 @@ jobs:
- name: Deploy Android Production to Firebase
uses: wzieba/[email protected]
with:
appId: ${{ secrets.FIREBASE_ANDROID_APP_ID_PRODUCTION }}
appId: ${{ vars.FIREBASE_ANDROID_APP_ID }}
serviceCredentialsFileContent: ${{ secrets.FIREBASE_DISTRIBUTION_CREDENTIAL_JSON }}
groups: ${{ vars.FIREBASE_DISTRIBUTION_TESTER_GROUPS }}
file: build/app/outputs/flutter-apk/app-production-debug.apk
9 changes: 5 additions & 4 deletions .github/workflows/android_deploy_production_to_playstore.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ jobs:
build_and_deploy_android:
name: Build & Deploy Android
runs-on: ubuntu-latest
environment: production
timeout-minutes: 30
steps:
- name: Check out
Expand Down Expand Up @@ -43,17 +44,17 @@ jobs:

- name: Set up .env
env:
ENV_PRODUCTION: ${{ secrets.ENV_PRODUCTION }}
ENV: ${{ secrets.ENV }}
run: |
echo $ENV_PRODUCTION > .env
echo "$ENV" > .env
- name: Set up release signing configs
env:
ANDROID_RELEASE_KEYSTORE_BASE64: ${{ secrets.ANDROID_RELEASE_KEYSTORE_BASE64 }}
ANDROID_SIGNING_PROPERTIES_BASE64: ${{ secrets.ANDROID_SIGNING_PROPERTIES_BASE64 }}
ANDROID_SIGNING_PROPERTIES: ${{ secrets.ANDROID_SIGNING_PROPERTIES }}
run: |
echo $ANDROID_RELEASE_KEYSTORE_BASE64 | base64 --decode > android/config/release.keystore
echo $ANDROID_SIGNING_PROPERTIES_BASE64 | base64 --decode > android/signing.properties
echo "$ANDROID_SIGNING_PROPERTIES" > android/signing.properties
- name: Build Production App Bundle
run: flutter build appbundle --flavor production --release --build-number $GITHUB_RUN_NUMBER
Expand Down
7 changes: 4 additions & 3 deletions .github/workflows/android_deploy_staging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ jobs:
build_and_deploy_android:
name: Build & Deploy Android
runs-on: ubuntu-latest
environment: staging
timeout-minutes: 30
environment: staging
steps:
Expand Down Expand Up @@ -44,9 +45,9 @@ jobs:

- name: Set up .env.staging
env:
ENV_STAGING: ${{ secrets.ENV_STAGING }}
ENV: ${{ secrets.ENV }}
run: |
echo $ENV_STAGING > .env.staging
echo "$ENV" > .env.staging
# App Bundle requires Firebase connected to Play Store to upload https://appdistribution.page.link/KPoa
- name: Build Android apk
Expand All @@ -55,7 +56,7 @@ jobs:
- name: Deploy Android Staging to Firebase
uses: wzieba/[email protected]
with:
appId: ${{ secrets.FIREBASE_ANDROID_APP_ID_STAGING }}
appId: ${{ vars.FIREBASE_ANDROID_APP_ID }}
serviceCredentialsFileContent: ${{ secrets.FIREBASE_DISTRIBUTION_CREDENTIAL_JSON }}
groups: ${{ vars.FIREBASE_DISTRIBUTION_TESTER_GROUPS }}
file: build/app/outputs/flutter-apk/app-staging-debug.apk
7 changes: 4 additions & 3 deletions .github/workflows/ios_deploy_staging_to_firebase.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ jobs:
build_and_upload_staging_app_to_firebase:
name: Build And Upload iOS Staging Application To Firebase
runs-on: macOS-latest
environment: staging
env:
TEAM_ID: ${{ secrets.TEAM_ID }}
FASTLANE_USER: ${{ secrets.FASTLANE_USER }}
Expand All @@ -18,7 +19,7 @@ jobs:
MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }}
KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }}
FIREBASE_CLI_TOKEN: ${{ secrets.FIREBASE_CLI_TOKEN }}
FIREBASE_APP_ID_STAGING: ${{ secrets.FIREBASE_IOS_APP_ID_STAGING }}
FIREBASE_APP_ID_STAGING: ${{ vars.FIREBASE_IOS_APP_ID }}
FIREBASE_DISTRIBUTION_TESTER_GROUPS: ${{ vars.FIREBASE_DISTRIBUTION_TESTER_GROUPS }}
GITHUB_RUN_NUMBER: $GITHUB_RUN_NUMBER
steps:
Expand Down Expand Up @@ -50,9 +51,9 @@ jobs:

- name: Set up .env.staging
env:
ENV_STAGING: ${{ secrets.ENV_STAGING }}
ENV: ${{ secrets.ENV }}
run: |
echo $ENV_STAGING > .env.staging
echo "$ENV" > .env.staging
- name: Run code generator
run: flutter packages pub run build_runner build --delete-conflicting-outputs
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ jobs:
build_and_deploy_android:
name: Build & Deploy Android
runs-on: ubuntu-latest
environment: production
timeout-minutes: 30
steps:
- name: Check out
Expand All @@ -34,9 +35,9 @@ jobs:

- name: Set up .env
env:
ENV_PRODUCTION: ${{#mustacheCase}}secrets.ENV_PRODUCTION{{/mustacheCase}}
ENV: ${{#mustacheCase}}secrets.ENV{{/mustacheCase}}
run: |
echo $ENV_PRODUCTION > .env
echo "$ENV" > .env
# App Bundle requires Firebase connected to Play Store to upload https://appdistribution.page.link/KPoa
- name: Build Android apk
Expand All @@ -45,7 +46,7 @@ jobs:
- name: Deploy Android Production to Firebase
uses: wzieba/[email protected]
with:
appId: ${{#mustacheCase}}secrets.FIREBASE_ANDROID_APP_ID_PRODUCTION{{/mustacheCase}}
appId: ${{#mustacheCase}}vars.FIREBASE_ANDROID_APP_ID{{/mustacheCase}}
serviceCredentialsFileContent: ${{#mustacheCase}}secrets.FIREBASE_DISTRIBUTION_CREDENTIAL_JSON{{/mustacheCase}}
groups: ${{#mustacheCase}}vars.FIREBASE_DISTRIBUTION_TESTER_GROUPS{{/mustacheCase}}
file: build/app/outputs/flutter-apk/app-production-debug.apk
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ jobs:
build_and_deploy_android:
name: Build & Deploy Android
runs-on: ubuntu-latest
environment: production
timeout-minutes: 30
steps:
- name: Check out
Expand All @@ -34,17 +35,17 @@ jobs:

- name: Set up .env
env:
ENV_PRODUCTION: ${{#mustacheCase}}secrets.ENV_PRODUCTION{{/mustacheCase}}
ENV: ${{#mustacheCase}}secrets.ENV{{/mustacheCase}}
run: |
echo $ENV_PRODUCTION > .env
echo "$ENV" > .env
- name: Set up release signing configs
env:
ANDROID_RELEASE_KEYSTORE_BASE64: ${{#mustacheCase}}secrets.ANDROID_RELEASE_KEYSTORE_BASE64{{/mustacheCase}}
ANDROID_SIGNING_PROPERTIES_BASE64: ${{#mustacheCase}}secrets.ANDROID_SIGNING_PROPERTIES_BASE64{{/mustacheCase}}
ANDROID_SIGNING_PROPERTIES: ${{#mustacheCase}}secrets.ANDROID_SIGNING_PROPERTIES{{/mustacheCase}}
run: |
echo $ANDROID_RELEASE_KEYSTORE_BASE64 | base64 --decode > android/config/release.keystore
echo $ANDROID_SIGNING_PROPERTIES_BASE64 | base64 --decode > android/signing.properties
echo "$ANDROID_SIGNING_PROPERTIES" > android/signing.properties
- name: Build Production App Bundle
run: flutter build appbundle --flavor production --release --build-number $GITHUB_RUN_NUMBER
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ jobs:
build_and_deploy_android:
name: Build & Deploy Android
runs-on: ubuntu-latest
environment: staging
timeout-minutes: 30
steps:
- name: Check out
Expand All @@ -34,9 +35,9 @@ jobs:

- name: Set up .env.staging
env:
ENV_STAGING: ${{#mustacheCase}}secrets.ENV_STAGING{{/mustacheCase}}
ENV: ${{#mustacheCase}}secrets.ENV{{/mustacheCase}}
run: |
echo $ENV_STAGING > .env.staging
echo "$ENV" > .env.staging
# App Bundle requires Firebase connected to Play Store to upload https://appdistribution.page.link/KPoa
- name: Build Android apk
Expand All @@ -45,7 +46,7 @@ jobs:
- name: Deploy Android Staging to Firebase
uses: wzieba/[email protected]
with:
appId: ${{#mustacheCase}}secrets.FIREBASE_ANDROID_APP_ID_STAGING{{/mustacheCase}}
appId: ${{#mustacheCase}}vars.FIREBASE_ANDROID_APP_ID{{/mustacheCase}}
serviceCredentialsFileContent: ${{#mustacheCase}}secrets.FIREBASE_DISTRIBUTION_CREDENTIAL_JSON{{/mustacheCase}}
groups: ${{#mustacheCase}}vars.FIREBASE_DISTRIBUTION_TESTER_GROUPS{{/mustacheCase}}
file: build/app/outputs/flutter-apk/app-staging-debug.apk
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ jobs:
build_and_upload_staging_app_to_firebase:
name: Build And Upload iOS Staging Application To Firebase
runs-on: macOS-latest
environment: staging
env:
TEAM_ID: ${{#mustacheCase}}secrets.TEAM_ID{{/mustacheCase}}
FASTLANE_USER: ${{#mustacheCase}}secrets.FASTLANE_USER{{/mustacheCase}}
Expand All @@ -18,7 +19,7 @@ jobs:
MATCH_PASSWORD: ${{#mustacheCase}}secrets.MATCH_PASSWORD{{/mustacheCase}}
KEYCHAIN_PASSWORD: ${{#mustacheCase}}secrets.KEYCHAIN_PASSWORD{{/mustacheCase}}
FIREBASE_CLI_TOKEN: ${{#mustacheCase}}secrets.FIREBASE_CLI_TOKEN{{/mustacheCase}}
FIREBASE_APP_ID_STAGING: ${{#mustacheCase}}secrets.FIREBASE_IOS_APP_ID_STAGING{{/mustacheCase}}
FIREBASE_APP_ID_STAGING: ${{#mustacheCase}}vars.FIREBASE_IOS_APP_ID{{/mustacheCase}}
FIREBASE_DISTRIBUTION_TESTER_GROUPS: ${{#mustacheCase}}vars.FIREBASE_DISTRIBUTION_TESTER_GROUPS{{/mustacheCase}}
GITHUB_RUN_NUMBER: $GITHUB_RUN_NUMBER
steps:
Expand All @@ -41,9 +42,9 @@ jobs:

- name: Set up .env.staging
env:
ENV_STAGING: ${{#mustacheCase}}secrets.ENV_STAGING{{/mustacheCase}}
ENV: ${{#mustacheCase}}secrets.ENV{{/mustacheCase}}
run: |
echo $ENV_STAGING > .env.staging
echo "$ENV" > .env.staging
- name: Run code generator
run: flutter packages pub run build_runner build --delete-conflicting-outputs
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ jobs:
build_and_upload_to_app_store:
name: Build And Upload iOS Application To AppStore
runs-on: macOS-latest
environment: staging
timeout-minutes: 30
env:
TEAM_ID: ${{#mustacheCase}}secrets.TEAM_ID{{/mustacheCase}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ jobs:
build_and_upload_to_testflight:
name: Build And Upload iOS Application To TestFlight
runs-on: macOS-latest
environment: staging
timeout-minutes: 30
env:
TEAM_ID: ${{#mustacheCase}}secrets.TEAM_ID{{/mustacheCase}}
Expand Down

0 comments on commit 5391b6b

Please sign in to comment.