diff --git a/.firebaserc b/.firebaserc new file mode 100644 index 000000000..b011f2a09 --- /dev/null +++ b/.firebaserc @@ -0,0 +1,5 @@ +{ + "projects": { + "default": "comettools-lunasea" + } +} \ No newline at end of file diff --git a/.github/actions/prepare_for_build/action.yml b/.github/actions/prepare_for_build/action.yml index d1b4d710d..8dbb23af7 100644 --- a/.github/actions/prepare_for_build/action.yml +++ b/.github/actions/prepare_for_build/action.yml @@ -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 @@ -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 @@ -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 @@ -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' }} @@ -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 \ No newline at end of file + run: flutter pub get diff --git a/.github/workflows/build_android.yml b/.github/workflows/build_android.yml index 3d743aefd..dab5e5bbb 100644 --- a/.github/workflows/build_android.yml +++ b/.github/workflows/build_android.yml @@ -8,7 +8,7 @@ on: type: string secrets: - FIREBASE_OPTIONS: + FIREBASE_TOKEN: required: true KEY_JKS: required: true @@ -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 @@ -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 diff --git a/.github/workflows/build_ios.yml b/.github/workflows/build_ios.yml index c931112b5..b366d82eb 100644 --- a/.github/workflows/build_ios.yml +++ b/.github/workflows/build_ios.yml @@ -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 @@ -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 @@ -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 }} diff --git a/.github/workflows/build_linux.yml b/.github/workflows/build_linux.yml index 427bd7fc5..a7e05e20f 100644 --- a/.github/workflows/build_linux.yml +++ b/.github/workflows/build_linux.yml @@ -8,7 +8,7 @@ on: type: string secrets: - FIREBASE_OPTIONS: + FIREBASE_TOKEN: required: true jobs: @@ -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 diff --git a/.github/workflows/build_macos.yml b/.github/workflows/build_macos.yml index 54528b99c..143084971 100644 --- a/.github/workflows/build_macos.yml +++ b/.github/workflows/build_macos.yml @@ -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 @@ -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 @@ -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 }} @@ -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 @@ -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 }} diff --git a/.github/workflows/build_web.yml b/.github/workflows/build_web.yml index b25b85eea..74572b01e 100644 --- a/.github/workflows/build_web.yml +++ b/.github/workflows/build_web.yml @@ -8,7 +8,7 @@ on: type: string secrets: - FIREBASE_OPTIONS: + FIREBASE_TOKEN: required: true jobs: @@ -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 diff --git a/.github/workflows/prepare.yml b/.github/workflows/prepare.yml index 51b932cd0..b5ce66711 100644 --- a/.github/workflows/prepare.yml +++ b/.github/workflows/prepare.yml @@ -19,7 +19,7 @@ on: value: ${{ jobs.build-version.outputs.build-version }} secrets: - FIREBASE_OPTIONS: + FIREBASE_TOKEN: required: true jobs: @@ -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 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c3eb14e49..e37a076df 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -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 @@ -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 }} @@ -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 }} @@ -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 @@ -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 }} @@ -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 diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index 4479811c6..f163323ff 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -3,7 +3,7 @@ name: Validate on: workflow_call: secrets: - FIREBASE_OPTIONS: + FIREBASE_TOKEN: required: true jobs: @@ -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 diff --git a/.gitignore b/.gitignore index 14f56d8be..33a5c11d1 100644 --- a/.gitignore +++ b/.gitignore @@ -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 @@ -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 diff --git a/ios/fastlane/Fastfile b/ios/fastlane/Fastfile index 8beeaa7f3..b3e9c625e 100644 --- a/ios/fastlane/Fastfile +++ b/ios/fastlane/Fastfile @@ -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", diff --git a/macos/fastlane/Fastfile b/macos/fastlane/Fastfile index 19d755e16..3146fcda7 100644 --- a/macos/fastlane/Fastfile +++ b/macos/fastlane/Fastfile @@ -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: { @@ -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: { diff --git a/package.json b/package.json index 3620cb836..f1f8a05bc 100644 --- a/package.json +++ b/package.json @@ -22,10 +22,9 @@ "fastlane:update:android": "cd android && bundle update", "fastlane:update:ios": "cd ios && bundle update", "fastlane:update:macos": "cd macos && bundle update", - "generate": "npm run generate:firebase && npm run generate:assets && npm run generate:build_runner && npm run generate:localization", + "generate": "npm run generate:assets && npm run generate:build_runner && npm run generate:localization", "generate:assets": "dart pub global activate spider && spider build", "generate:build_runner": "flutter packages pub run build_runner build --delete-conflicting-outputs", - "generate:firebase": "rm -rf lib/firebase_options.dart && npm install -g firebase-tools && firebase login && dart pub global activate flutterfire_cli && flutterfire configure", "generate:localization": "dart ./scripts/generate_localization.dart", "git:ignore": "npm run git:ignore:flavor && npm run git:ignore:firebase", "git:ignore:flavor": "git update-index --skip-worktree .flavor",