Skip to content

build(deps-dev): Bump firebase-tools from 9.1.0 to 12.4.6 in /tools #1509

build(deps-dev): Bump firebase-tools from 9.1.0 to 12.4.6 in /tools

build(deps-dev): Bump firebase-tools from 9.1.0 to 12.4.6 in /tools #1509

Workflow file for this run

name: Client CI
env:
FLUTTER_VERSION: "1.22.1"
on:
push:
paths:
- ".github/workflows/**"
- "api/**"
- "client/**"
- "docs/**"
- "tools/**"
- "LICENSE"
pull_request:
branches: [master]
paths:
- ".github/workflows/**"
- "api/**"
- "client/**"
- "docs/**"
- "tools/**"
- "LICENSE"
jobs:
test:
name: Test client on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
steps:
- uses: actions/checkout@v2
- run: git clone https://github.com/flutter/flutter.git --depth 1 -b $FLUTTER_VERSION _flutter
- run: echo "$GITHUB_WORKSPACE/_flutter/bin" >> $GITHUB_PATH
- run: flutter doctor -v
- run: flutter pub get
working-directory: ./client
- run: flutter analyze --no-pub
working-directory: ./client
- run: flutter format lib/** --set-exit-if-changed
working-directory: ./client
- run: flutter test --no-pub
working-directory: ./client
autogen_update_check:
name: Check auto-generated client files are up-to-date
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: git clone https://github.com/flutter/flutter.git --depth 1 -b $FLUTTER_VERSION _flutter
- run: echo "$GITHUB_WORKSPACE/_flutter/bin" >> $GITHUB_PATH
- run: flutter doctor -v
- run: flutter pub get
working-directory: ./client
- run: echo PHASE 1 - Ensure auto-gened MobX stores
- run: flutter packages pub run build_runner build --delete-conflicting-outputs
working-directory: ./client
- run: flutter format lib/**
working-directory: ./client
- run: git diff --exit-code
- run: echo PHASE 2 - Ensure auto-gened protocol buffers
- run: sudo apt install -y protobuf-compiler
- run: protoc --version
- run: flutter pub global activate protoc_plugin ^19.0.1
working-directory: ./client
- run: echo "$HOME/.pub-cache/bin" >> $GITHUB_PATH
- run: ./tools/gen-client-protos.sh
- run: flutter format lib/**
working-directory: ./client
- run: git diff --exit-code
build_ios:
name: Build iOS app
runs-on: macos-latest
steps:
- uses: actions/checkout@v2
- run: git clone https://github.com/flutter/flutter.git --depth 1 -b $FLUTTER_VERSION _flutter
- run: echo "$GITHUB_WORKSPACE/_flutter/bin" >> $GITHUB_PATH
- run: flutter doctor -v
- run: flutter pub get
working-directory: ./client
- run: git diff --exit-code
- run: ./tools/gen-client-buildinfo.sh
- run: flutter build ios --release --flavor staging --no-codesign
working-directory: ./client
build_android:
# Firebase requires fat APKs, not AABs.
name: Build Android APK (Staging)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v1
with:
java-version: "11.0.9"
- run: git clone https://github.com/flutter/flutter.git --depth 1 -b $FLUTTER_VERSION _flutter
- run: echo "$GITHUB_WORKSPACE/_flutter/bin" >> $GITHUB_PATH
- run: flutter doctor -v
- run: flutter pub get
working-directory: ./client
- run: git diff --exit-code
- run: ./tools/gen-client-buildinfo.sh
- run: flutter build appbundle --release --flavor staging
working-directory: ./client
# TODO: generate apk from appbundle using bundletool
- run: flutter build apk --release --flavor staging
working-directory: ./client
- name: Upload Staging APK artifact
uses: actions/upload-artifact@v2
with:
name: staging-apk
path: ./client/build/app/outputs/flutter-apk/app-staging-release.apk
deploy_apk_to_firebase_staging:
name: Deploy APK to Firebase App Distribution (Staging)
runs-on: ubuntu-latest
needs:
- build_android
- test
# SECURITY: This job uses staging secrets; do not enable it for
# pull requests.
if: |
github.repository == 'WorldHealthOrganization/app' &&
github.ref == 'refs/heads/master' &&
github.event_name == 'push'
env:
FIREBASE_STAGING_APP_ID: "1:1057717871229:android:4fbe832a3de230450dc714"
LOG_URL: "https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}"
steps:
- uses: actions/checkout@v2
- name: Download Staging APK Artifact
uses: actions/download-artifact@v2
with:
name: staging-apk
path: tools
- name: Setup Node.js
uses: actions/setup-node@v1
with:
node-version: 12
- name: Install Firebase CLI
run: npm install
working-directory: ./tools
- name: Setup Firebase Credentials
shell: bash
run: |
echo "$BASE64_KEY_JSON" | base64 --decode > $GOOGLE_APPLICATION_CREDENTIALS_GPG
gpg --quiet --batch --yes --decrypt --passphrase="$KEY_PASSPHRASE" --output $GOOGLE_APPLICATION_CREDENTIALS $GOOGLE_APPLICATION_CREDENTIALS_GPG
rm $GOOGLE_APPLICATION_CREDENTIALS_GPG
env:
BASE64_KEY_JSON: "${{ secrets.FIREBASE_APPDEPLOY_STAGING_SVCACCT_JSON }}"
KEY_PASSPHRASE: "${{ secrets.FIREBASE_APPDEPLOY_STAGING_SVCACCT_PASSPHRASE }}"
GOOGLE_APPLICATION_CREDENTIALS: "${{ runner.temp }}/fbappdeploy.json"
GOOGLE_APPLICATION_CREDENTIALS_GPG: "${{ runner.temp }}/fbappdeploy.json.gpg"
- id: newDeployment
name: Track Environment Deployment Status
uses: actions/github-script@v2
with:
previews: flash,ant-man
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
const { data: deployment } = await github.repos.createDeployment({
owner: context.repo.owner,
repo: context.repo.repo,
ref: context.sha,
auto_merge: false,
environment: 'firebase-staging-android',
required_contexts: [],
});
await github.repos.createDeploymentStatus({
owner: context.repo.owner,
repo: context.repo.repo,
deployment_id: deployment.id,
state: 'in_progress',
log_url: process.env.LOG_URL,
});
return deployment.id;
- name: Run Firebase App Distribution
shell: bash
run: |
npx firebase appdistribution:distribute --app "$FIREBASE_STAGING_APP_ID" --release-notes "$RELEASE_NOTES" --groups "every-build" app-staging-release.apk
env:
GOOGLE_APPLICATION_CREDENTIALS: "${{ runner.temp }}/fbappdeploy.json"
RELEASE_NOTES: "https://github.com/${{ github.repository }}/tree/${{ github.sha }} . Any prior version of this app will need to be uninstalled prior to installing this build."
working-directory: ./tools
- name: Destroy Firebase Credentials
run: rm $GOOGLE_APPLICATION_CREDENTIALS
if: ${{ always() }}
env:
GOOGLE_APPLICATION_CREDENTIALS: "${{ runner.temp }}/fbappdeploy.json"
- uses: actions/github-script@v2
name: Finalize Deployment Status
if: ${{ always() }}
with:
previews: flash,ant-man
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
await github.repos.createDeploymentStatus({
owner: context.repo.owner,
repo: context.repo.repo,
deployment_id: '${{steps.newDeployment.outputs.result}}',
state: '${{job.status}}' === 'success' ? 'success' : 'failure',
log_url: process.env.LOG_URL,
environment_url: '${{job.status}}' === 'success' ? 'https://console.firebase.google.com/project/who-mh-staging/appdistribution/app/android:org.who.WHOMyHealth/releases' : '',
auto_inactive: '${{job.status}}' === 'success'
});