Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(.github/workflows): Firebase CI/CD #3238

Merged
merged 3 commits into from
Apr 3, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
144 changes: 144 additions & 0 deletions .github/workflows/firebase-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
name: firebase-release

on:
push:
tags:
- 'firebase-*'

jobs:
distribute-android:
runs-on: ubuntu-latest
timeout-minutes: 120

steps:
- uses: actions/checkout@v2

- uses: actions/setup-node@v2
with:
node-version: '16.15.0'

- name: Setup firebase
run: |
curl -sL https://firebase.tools | bash

- name: Build Ionic
env:
NUMBERS_STORAGE_BASE_URL: ${{ secrets.NUMBERS_STORAGE_BASE_URL }}
NUMBERS_STORAGE_TRUSTED_CLIENT_KEY: ${{ secrets.NUMBERS_STORAGE_TRUSTED_CLIENT_KEY }}
NUMBERS_BUBBLE_DB_URL: ${{ secrets.NUMBERS_BUBBLE_DB_URL }}
NUMBERS_BUBBLE_IFRAME_URL: ${{ secrets.NUMBERS_BUBBLE_IFRAME_URL }}
BUBBLE_API_URL: ${{ secrets.BUBBLE_API_URL }}
APPS_FLYER_DEV_KEY: ${{ secrets.APPS_FLYER_DEV_KEY }}
NUMBERS_PQINA_NPM_KEY: ${{ secrets.NUMBERS_PQINA_NPM_KEY }}
PIPEDREAM_DELETE_CAPTURE_ACCOUNT: ${{ secrets.PIPEDREAM_DELETE_CAPTURE_ACCOUNT }}
run: |
npm run preconfig.npmrc
npm install -g @ionic/cli
npm install
npm run build

- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: 'temurin' # https://github.com/actions/setup-java#supported-distributions
java-version: '17'

- name: Build Android release bundle (AAB) for Firebase
run: |
npx cap sync android
cd android/
./gradlew bundleRelease

- name: Sign release AAB
uses: r0adkll/sign-android-release@v1.0.4
with:
releaseDirectory: ./android/app/build/outputs/bundle/release
signingKeyBase64: ${{ secrets.ANDROID_KEYSTORE_FILE }}
alias: ${{ secrets.ANDROID_KEY_ALIAS }}
keyStorePassword: ${{ secrets.ANDROID_KEYSTORE_PASSWORD }}
keyPassword: ${{ secrets.ANDROID_KEY_PASSWORD }}

- name: Distribute Android App to Firebase
env:
APP_ID: ${{ secrets.FIREBASE_ANDROID_APP_ID }}
TEST_GROUPS: ${{ secrets.FIREBASE_TEST_GROUPS }}
GOOGLE_APPLICATION_CREDENTIALS: service_account.json
GOOGLE_APPLICATION_CREDENTIALS_CONTENT: ${{ secrets.FIREBASE_SERVICE_ACCOUNT_JSON }}
run: |
echo "$GOOGLE_APPLICATION_CREDENTIALS_CONTENT" > "$GOOGLE_APPLICATION_CREDENTIALS"
firebase appdistribution:distribute ./android/app/build/outputs/bundle/release/app-release.aab --app ${APP_ID} --groups "${TEST_GROUPS}"

distribute-ios:
runs-on: macos-latest
timeout-minutes: 120

steps:
- uses: actions/checkout@v2

- uses: actions/setup-node@v2
with:
node-version: '16.15.0'

- name: Setup firebase
run: |
curl -sL https://firebase.tools | bash

- name: Build Ionic
env:
NUMBERS_STORAGE_BASE_URL: ${{ secrets.NUMBERS_STORAGE_BASE_URL }}
NUMBERS_STORAGE_TRUSTED_CLIENT_KEY: ${{ secrets.NUMBERS_STORAGE_TRUSTED_CLIENT_KEY }}
NUMBERS_BUBBLE_DB_URL: ${{ secrets.NUMBERS_BUBBLE_DB_URL }}
NUMBERS_BUBBLE_IFRAME_URL: ${{ secrets.NUMBERS_BUBBLE_IFRAME_URL }}
BUBBLE_API_URL: ${{ secrets.BUBBLE_API_URL }}
APPS_FLYER_DEV_KEY: ${{ secrets.APPS_FLYER_DEV_KEY }}
NUMBERS_PQINA_NPM_KEY: ${{ secrets.NUMBERS_PQINA_NPM_KEY }}
PIPEDREAM_DELETE_CAPTURE_ACCOUNT: ${{ secrets.PIPEDREAM_DELETE_CAPTURE_ACCOUNT }}
run: |
npm run preconfig.npmrc
npm install -g @ionic/cli
npm install
npm run build

- name: Import the Code-Signing PKCS12 Certificate
uses: apple-actions/import-codesign-certs@v1
with:
p12-file-base64: ${{ secrets.CERTIFICATES_P12 }}
p12-password: ${{ secrets.CERTIFICATES_P12_PASSWORD }}

- name: Download provisioning profiles
uses: Apple-Actions/download-provisioning-profiles@v1
with:
bundle-id: io.numbersprotocol.capturelite
profile-type: 'IOS_APP_ADHOC'
issuer-id: ${{ secrets.APPSTORE_ISSUER_ID }}
api-key-id: ${{ secrets.APPSTORE_KEY_ID }}
api-private-key: ${{ secrets.APPSTORE_PRIVATE_KEY }}

- name: Get current time
uses: 1466587594/get-current-time@v2
id: current-time
with:
format: YYYYMMDDHHmmss

- name: Build iOS Xcode Archive
env:
PROVISIONING_PROFILE: ${{ secrets.FIREBASE_PROVISIONING_PROFILE_NAME }}
run: |
npx cap sync ios
sed -i '' "s/NumbersAppDistributionV6/${PROVISIONING_PROFILE}/g" ios/App/ExportOptions.plist
sed -i '' 's/app-store/ad-hoc/g' ios/App/ExportOptions.plist
xcodebuild archive -workspace ios/App/App.xcworkspace -scheme App -sdk iphoneos -configuration Release -archivePath build/App.xcarchive -showBuildTimingSummary CURRENT_PROJECT_VERSION=${{ steps.current-time.outputs.formattedTime }} PROVISIONING_PROFILE_SPECIFIER=${PROVISIONING_PROFILE} -allowProvisioningUpdates

- name: Export IPA from Xcode Archive
run: |
xcodebuild -exportArchive -archivePath build/App.xcarchive -exportPath build -exportOptionsPlist ios/App/ExportOptions.plist -allowProvisioningUpdates

- name: Distribute iOS App to Firebase
env:
APP_ID: ${{ secrets.FIREBASE_IOS_APP_ID }}
TEST_GROUPS: ${{ secrets.FIREBASE_TEST_GROUPS }}
GOOGLE_APPLICATION_CREDENTIALS: service_account.json
GOOGLE_APPLICATION_CREDENTIALS_CONTENT: ${{ secrets.FIREBASE_SERVICE_ACCOUNT_JSON }}
run: |
echo "$GOOGLE_APPLICATION_CREDENTIALS_CONTENT" > "$GOOGLE_APPLICATION_CREDENTIALS"
firebase appdistribution:distribute build/App.ipa --app ${APP_ID} --groups "${TEST_GROUPS}"
Loading