Skip to content

Commit

Permalink
chore(ci): fetch Firebase configuration via CLI [skip ci]
Browse files Browse the repository at this point in the history
  • Loading branch information
JagandeepBrar committed Apr 3, 2022
1 parent d7431b1 commit 7c57d40
Show file tree
Hide file tree
Showing 14 changed files with 69 additions and 47 deletions.
5 changes: 5 additions & 0 deletions .firebaserc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"projects": {
"default": "comettools-lunasea"
}
}
28 changes: 19 additions & 9 deletions .github/actions/prepare_for_build/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ name: 'Prepare for Build'
description: 'Setup all required dependencies and secrets for building the given platform'

inputs:
firebase-token:
description: 'Firebase Token'
required: true
platform:
description: 'Platform to be Built'
required: true
Expand All @@ -23,10 +26,6 @@ inputs:
description: 'App Store Connect API Key'
required: false
default: ''
firebase-options:
description: 'Firebase Configuration'
required: false
default: ''
google-play-key:
description: 'Google Play Store API Key'
required: false
Expand Down Expand Up @@ -69,6 +68,11 @@ runs:
distribution: zulu
java-version: 11

- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: 16

- name: Install Ruby
if: ${{ inputs.platform == 'android' || inputs.platform == 'ios' || inputs.platform == 'macos' }}
uses: ruby/setup-ruby@v1
Expand All @@ -94,7 +98,15 @@ runs:
echo ${{ inputs.google-play-key }} | base64 --decode > keys/googleplay.json
echo ${{ inputs.android-key-jks }} | base64 --decode > android/key.jks
echo ${{ inputs.android-key-properties }} | base64 --decode > android/key.properties
echo ${{ inputs.firebase-options }} | base64 --decode > lib/firebase_options.dart
- name: Setup Firebase Configuration
shell: bash
env:
FIREBASE_TOKEN: ${{ inputs.firebase-token }}
run: |
npm install -g firebase-tools
dart pub global activate flutterfire_cli
flutterfire configure -y
- name: Setup Android Platform
if: ${{ inputs.platform == 'android' }}
Expand Down Expand Up @@ -130,11 +142,9 @@ runs:
- name: Setup Web Platform
if: ${{ inputs.platform == 'web' }}
shell: bash
run: |
flutter pub get
run: flutter pub get

- name: Setup Test Platform
if: ${{ inputs.platform == 'test' }}
shell: bash
run: |
flutter pub get
run: flutter pub get
6 changes: 3 additions & 3 deletions .github/workflows/build_android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
type: string

secrets:
FIREBASE_OPTIONS:
FIREBASE_TOKEN:
required: true
KEY_JKS:
required: true
Expand All @@ -23,10 +23,10 @@ jobs:
- name: Setup Environment
uses: JagandeepBrar/LunaSea/.github/actions/prepare_for_build@master
with:
firebase-token: ${{ secrets.FIREBASE_TOKEN }}
platform: android
android-key-jks: ${{ secrets.KEY_JKS }}
android-key-properties: ${{ secrets.KEY_PROPERTIES }}
firebase-options: ${{ secrets.FIREBASE_OPTIONS }}

- name: Build LunaSea
working-directory: ${{ github.workspace }}/android
Expand All @@ -45,10 +45,10 @@ jobs:
- name: Setup Environment
uses: JagandeepBrar/LunaSea/.github/actions/prepare_for_build@master
with:
firebase-token: ${{ secrets.FIREBASE_TOKEN }}
platform: android
android-key-jks: ${{ secrets.KEY_JKS }}
android-key-properties: ${{ secrets.KEY_PROPERTIES }}
firebase-options: ${{ secrets.FIREBASE_OPTIONS }}

- name: Build LunaSea
working-directory: ${{ github.workspace }}/android
Expand Down
7 changes: 5 additions & 2 deletions .github/workflows/build_ios.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ on:
required: true
APPLE_TEAM_ID:
required: true
FIREBASE_OPTIONS:
FIREBASE_TOKEN:
required: true
IOS_CODESIGNING_IDENTITY:
required: true
MATCH_KEYCHAIN_NAME:
required: true
Expand All @@ -33,8 +35,8 @@ jobs:
- name: Setup Environment
uses: JagandeepBrar/LunaSea/.github/actions/prepare_for_build@master
with:
firebase-token: ${{ secrets.FIREBASE_TOKEN }}
platform: ios
firebase-options: ${{ secrets.FIREBASE_OPTIONS }}
match-ssh-private-key: ${{ secrets.MATCH_SSH_PRIVATE_KEY }}

- name: Build LunaSea
Expand All @@ -43,6 +45,7 @@ jobs:
APPLE_ID: ${{ secrets.APPLE_ID }}
APPLE_ITC_TEAM_ID: ${{ secrets.APPLE_ITC_TEAM_ID }}
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
IOS_CODESIGNING_IDENTITY: ${{ secrets.IOS_CODESIGNING_IDENTITY }}
MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }}
MATCH_KEYCHAIN_NAME: ${{ secrets.MATCH_KEYCHAIN_NAME }}
MATCH_KEYCHAIN_PASSWORD: ${{ secrets.MATCH_KEYCHAIN_PASSWORD }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/build_linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
type: string

secrets:
FIREBASE_OPTIONS:
FIREBASE_TOKEN:
required: true

jobs:
Expand All @@ -19,8 +19,8 @@ jobs:
- name: Setup Environment
uses: JagandeepBrar/LunaSea/.github/actions/prepare_for_build@master
with:
firebase-token: ${{ secrets.FIREBASE_TOKEN }}
platform: linux
firebase-options: ${{ secrets.FIREBASE_OPTIONS }}

- name: Build LunaSea
uses: snapcore/action-build@v1
Expand Down
12 changes: 9 additions & 3 deletions .github/workflows/build_macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,11 @@ on:
required: true
APPLE_TEAM_ID:
required: true
FIREBASE_OPTIONS:
FIREBASE_TOKEN:
required: true
MACOS_INSTALLER_CERT_APP_STORE:
required: true
MACOS_INSTALLER_CERT_DIRECT:
required: true
MATCH_KEYCHAIN_NAME:
required: true
Expand All @@ -39,8 +43,8 @@ jobs:
- name: Setup Environment
uses: JagandeepBrar/LunaSea/.github/actions/prepare_for_build@master
with:
firebase-token: ${{ secrets.FIREBASE_TOKEN }}
platform: macos
firebase-options: ${{ secrets.FIREBASE_OPTIONS }}
match-ssh-private-key: ${{ secrets.MATCH_SSH_PRIVATE_KEY }}

- name: Build LunaSea
Expand All @@ -49,6 +53,7 @@ jobs:
APPLE_ID: ${{ secrets.APPLE_ID }}
APPLE_ITC_TEAM_ID: ${{ secrets.APPLE_ITC_TEAM_ID }}
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
MACOS_INSTALLER_CERT_APP_STORE: ${{ secrets.MACOS_INSTALLER_CERT_APP_STORE }}
MATCH_KEYCHAIN_NAME: ${{ secrets.MATCH_KEYCHAIN_NAME }}
MATCH_KEYCHAIN_PASSWORD: ${{ secrets.MATCH_KEYCHAIN_PASSWORD }}
MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }}
Expand All @@ -67,9 +72,9 @@ jobs:
- name: Setup Environment
uses: JagandeepBrar/LunaSea/.github/actions/prepare_for_build@master
with:
firebase-token: ${{ secrets.FIREBASE_TOKEN }}
platform: macos
appstore-connect-key: ${{ secrets.APPLE_STORE_CONNECT_KEY }}
firebase-options: ${{ secrets.FIREBASE_OPTIONS }}
match-ssh-private-key: ${{ secrets.MATCH_SSH_PRIVATE_KEY }}

- name: Build LunaSea
Expand All @@ -81,6 +86,7 @@ jobs:
APPLE_STORE_CONNECT_KEY_FILEPATH: ${{ github.workspace }}/keys/appstore.p8
APPLE_STORE_CONNECT_KEY_ID: ${{ secrets.APPLE_STORE_CONNECT_KEY_ID }}
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
MACOS_INSTALLER_CERT_DIRECT: ${{ secrets.MACOS_INSTALLER_CERT_DIRECT }}
MATCH_KEYCHAIN_NAME: ${{ secrets.MATCH_KEYCHAIN_NAME }}
MATCH_KEYCHAIN_PASSWORD: ${{ secrets.MATCH_KEYCHAIN_PASSWORD }}
MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/build_web.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
type: string

secrets:
FIREBASE_OPTIONS:
FIREBASE_TOKEN:
required: true

jobs:
Expand All @@ -19,8 +19,8 @@ jobs:
- name: Setup Environment
uses: JagandeepBrar/LunaSea/.github/actions/prepare_for_build@master
with:
firebase-token: ${{ secrets.FIREBASE_TOKEN }}
platform: web
firebase-options: ${{ secrets.FIREBASE_OPTIONS }}

- name: Build LunaSea
run: flutter build web --web-renderer canvaskit --release
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/prepare.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ on:
value: ${{ jobs.build-version.outputs.build-version }}

secrets:
FIREBASE_OPTIONS:
FIREBASE_TOKEN:
required: true

jobs:
Expand Down Expand Up @@ -107,9 +107,9 @@ jobs:
- name: Setup Environment
uses: JagandeepBrar/LunaSea/.github/actions/prepare_for_build@master
with:
firebase-token: ${{ secrets.FIREBASE_TOKEN }}
platform: test
skip-core: true
firebase-options: ${{ secrets.FIREBASE_OPTIONS }}

- name: Generate Flavor Configuration
run: echo $'FLAVOR=${{ inputs.flavor }}\nCOMMIT=${{ github.sha }}' > .flavor
Expand Down
17 changes: 10 additions & 7 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,14 @@ jobs:
with:
flavor: ${{ github.event.inputs.flavor || 'edge' }}
secrets:
FIREBASE_OPTIONS: ${{ secrets.FIREBASE_OPTIONS }}
FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }}

validate:
name: Validate
needs: [ prepare ]
uses: JagandeepBrar/LunaSea/.github/workflows/validate.yml@master
secrets:
FIREBASE_OPTIONS: ${{ secrets.FIREBASE_OPTIONS }}
FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }}

build-android:
name: Build Android
Expand All @@ -50,7 +50,7 @@ jobs:
with:
build-number: ${{ needs.prepare.outputs.build-number }}
secrets:
FIREBASE_OPTIONS: ${{ secrets.FIREBASE_OPTIONS }}
FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }}
KEY_JKS: ${{ secrets.KEY_JKS }}
KEY_PROPERTIES: ${{ secrets.KEY_PROPERTIES }}

Expand All @@ -64,7 +64,8 @@ jobs:
APPLE_ID: ${{ secrets.APPLE_ID }}
APPLE_ITC_TEAM_ID: ${{ secrets.APPLE_ITC_TEAM_ID }}
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
FIREBASE_OPTIONS: ${{ secrets.FIREBASE_OPTIONS }}
FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }}
IOS_CODESIGNING_IDENTITY: ${{ secrets.IOS_CODESIGNING_IDENTITY }}
MATCH_KEYCHAIN_NAME: ${{ secrets.MATCH_KEYCHAIN_NAME }}
MATCH_KEYCHAIN_PASSWORD: ${{ secrets.MATCH_KEYCHAIN_PASSWORD }}
MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }}
Expand All @@ -77,7 +78,7 @@ jobs:
with:
build-number: ${{ needs.prepare.outputs.build-number }}
secrets:
FIREBASE_OPTIONS: ${{ secrets.FIREBASE_OPTIONS }}
FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }}

build-macos:
name: Build macOS
Expand All @@ -92,7 +93,9 @@ jobs:
APPLE_STORE_CONNECT_KEY: ${{ secrets.APPLE_STORE_CONNECT_KEY }}
APPLE_STORE_CONNECT_KEY_ID: ${{ secrets.APPLE_STORE_CONNECT_KEY_ID }}
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
FIREBASE_OPTIONS: ${{ secrets.FIREBASE_OPTIONS }}
FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }}
MACOS_INSTALLER_CERT_APP_STORE: ${{ secrets.MACOS_INSTALLER_CERT_APP_STORE }}
MACOS_INSTALLER_CERT_DIRECT: ${{ secrets.MACOS_INSTALLER_CERT_DIRECT }}
MATCH_KEYCHAIN_NAME: ${{ secrets.MATCH_KEYCHAIN_NAME }}
MATCH_KEYCHAIN_PASSWORD: ${{ secrets.MATCH_KEYCHAIN_PASSWORD }}
MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }}
Expand All @@ -105,7 +108,7 @@ jobs:
with:
build-number: ${{ needs.prepare.outputs.build-number }}
secrets:
FIREBASE_OPTIONS: ${{ secrets.FIREBASE_OPTIONS }}
FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }}

publish:
name: Publish
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/validate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Validate
on:
workflow_call:
secrets:
FIREBASE_OPTIONS:
FIREBASE_TOKEN:
required: true

jobs:
Expand All @@ -14,8 +14,8 @@ jobs:
- name: Setup Environment
uses: JagandeepBrar/LunaSea/.github/actions/prepare_for_build@master
with:
firebase-token: ${{ secrets.FIREBASE_TOKEN }}
platform: test
firebase-options: ${{ secrets.FIREBASE_OPTIONS }}

- name: Analyze
uses: invertase/github-action-dart-analyzer@v1
Expand Down
16 changes: 6 additions & 10 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,9 @@ coverage/
# XCode Build Artifacts
ios/build/
ios/Runner.app.dSYM.zip
ios/Runner.ipa

macos/LunaSea.app
macos/LunaSea.app.dSYM.zip
macos/LunaSea.pkg
macos/LunaSea.app.zip

# Fastlane
/android/fastlane/report.xml
Expand All @@ -59,24 +57,22 @@ macos/LunaSea.pkg
/android/fastlane/Preview.html
/ios/fastlane/Preview.html
/macos/fastlane/Preview.html
/android/fastlane/metadata/android/en-CA/images
/ios/fastlane/screenshots
/ios/fastlane/metadata/review_information
/macos/fastlane/screenshots
/macos/fastlane/metadata/review_information

# Keys & Service Accounts
android/key.jks
android/key.properties

# Firebase
android/firebase_app_id_file.json
ios/firebase_app_id_file.json
macos/firebase_app_id_file.json

# Node Dependency directories
node_modules/
jspm_packages/

# Artifacts
output/
macos/LunaSea.app.dSYM.zip
macos/LunaSea.app.zip
*.apk
*.aab
*.ipa
Expand Down
2 changes: 1 addition & 1 deletion ios/fastlane/Fastfile
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ platform :ios do
scheme: "Runner",
workspace: "Runner.xcworkspace",
export_method: "app-store",
codesigning_identity: "Apple Distribution: Jagandeep Brar (VPH33JQH4R)",
codesigning_identity: ENV["IOS_CODESIGNING_IDENTITY"],
export_options: {
provisioningProfiles: {
"app.lunasea.lunasea" => "match AppStore app.lunasea.lunasea",
Expand Down
4 changes: 2 additions & 2 deletions macos/fastlane/Fastfile
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ platform :mac do
build_mac_app(
scheme: "Runner",
workspace: "Runner.xcworkspace",
installer_cert_name: "3rd Party Mac Developer Installer: Jagandeep Brar (VPH33JQH4R)",
installer_cert_name: ENV["MACOS_INSTALLER_CERT_APP_STORE"],
export_method: "app-store",
export_options: {
provisioningProfiles: {
Expand Down Expand Up @@ -97,7 +97,7 @@ platform :mac do
build_mac_app(
scheme: "Runner",
workspace: "Runner.xcworkspace",
installer_cert_name: "Developer ID Installer: Jagandeep Brar (VPH33JQH4R)",
installer_cert_name: ENV["MACOS_INSTALLER_CERT_DIRECT"],
export_method: "developer-id",
export_options: {
provisioningProfiles: {
Expand Down
Loading

0 comments on commit 7c57d40

Please sign in to comment.