add: support compressed fv signature #5462
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This is a basic workflow to help you get started with Actions | |
name: Android release | |
# Controls when the action will run. Triggers the workflow on push or pull request | |
# events but only for the master branch | |
on: | |
push: | |
branches: [master, staging, next] | |
pull_request: | |
branches: [master] | |
types: | |
- closed | |
workflow_dispatch: | |
inputs: | |
release: | |
description: 'release type' | |
required: true | |
default: '' | |
type: choice | |
options: | |
- master | |
- staging | |
- next | |
jobs: | |
codepush: | |
name: Hot Code Push | |
runs-on: ubuntu-latest | |
# hot push is for hotfix commits to PROD only | |
# manual PROD releases and release commits are going through the full flow | |
if: | | |
github.event_name != 'workflow_dispatch' && | |
endsWith(github.ref, '/next') && | |
!contains(github.event.head_commit.message, 'release prod') | |
steps: | |
- name: Pre-checks - Env is PROD | |
if: ${{ endsWith(github.ref, '/next') }} | |
run: | | |
echo "ENV=prod" >> $GITHUB_ENV | |
echo "APPCENTER_NAME=GoodDollar/GoodDollar-Android-production" >> $GITHUB_ENV | |
echo "APPCENTER_CODEPUSH_FLAGS=''" >> $GITHUB_ENV | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
cache: 'yarn' | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: '3.7.x' | |
- name: Cache & install dependencies | |
run: yarn --immutable | |
- name: add .env secrets | |
env: | |
SENTRYRC: ${{ secrets.sentryrc_file }} | |
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} | |
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }} | |
run: | | |
env_name="${{ env.ENV }}" | |
vercel_env_name="production" | |
vercel pull --yes --environment=production --token=${{ secrets.VERCEL_TOKEN }} | |
cat .vercel/.env.$vercel_env_name.local >> .env.$env_name | |
echo $env_name | |
cat .env.$env_name | |
echo "adding secrets to .env.$env_name file" | |
echo "$SENTRYRC" > android/sentry.properties | |
echo "REACT_APP_CODE_PUSH_KEY=$(grep -Po '(?<=^APPCENTER_CODEPUSH_TOKEN=)\S+' .env.$env_name)" >> .env.$env_name | |
- name: Code push release | |
run: | | |
BUILD_VERSION=`node -pe "require('./package.json')['version']"` | |
FORMATTED_VERSION=${BUILD_VERSION%.*}.x | |
APPCENTER_TOKEN=`node -pe "require('dotenv').parse(require('fs').readFileSync('.env.${{ env.ENV }}')).APPCENTER_ANDROID_TOKEN"` | |
echo Code push release target version ${FORMATTED_VERSION} | |
yarn lingui:compile | |
yarn animation:assets | |
npx appcenter codepush release-react --token ${APPCENTER_TOKEN} -a ${{ env.APPCENTER_NAME }} -d Production -t ${FORMATTED_VERSION} | |
build: | |
name: Build | |
# The type of runner that the job will run on | |
runs-on: ubuntu-latest | |
# Build runs on manual release or on any commit to dev/qa or on release commit to PROD | |
# GH actions not supports regex match, so to avoid adding extra step with custom action | |
# we compare to commt string to starts with 2. Should be updated on major version change | |
if: | | |
github.event_name == 'workflow_dispatch' || | |
endsWith(github.ref, '/master') || | |
endsWith(github.ref, '/staging') || ( | |
endsWith(github.ref, '/next') && ( | |
contains(github.event.head_commit.message, 'release prod') || | |
startsWith(github.event.head_commit.message, '2.') | |
) | |
) | |
# Steps represent a sequence of tasks that will be executed as part of the job | |
steps: | |
- name: Git branch name | |
id: git-branch-name | |
uses: EthanSK/git-branch-name-action@v1 | |
- name: Detect and set target branch | |
run: echo "TARGET_BRANCH=${{ github.event.inputs.release || env.GIT_BRANCH_NAME }}" >> $GITHUB_ENV | |
- name: Pre-checks - Env is Dev | |
run: | | |
echo "ENV=development" >> $GITHUB_ENV | |
echo "APPCENTER_NAME=GoodDollar/GoodDollar-Android-development" >> $GITHUB_ENV | |
echo "ANDROID_BUNDLE_PATH=./android/app/build/outputs/bundle/release/app-release.aab" >> $GITHUB_ENV | |
echo "BUILD_NUMBER_PREFIX=20" >> $GITHUB_ENV | |
echo "BUILD_VERSION_SUFFIX=-alpha" >> $GITHUB_ENV | |
- name: Pre-checks - Env is QA | |
if: ${{ env.TARGET_BRANCH == 'staging' }} | |
run: | | |
echo "ENV=staging" >> $GITHUB_ENV | |
echo "APPCENTER_NAME=GoodDollar/GoodDollar-Android-staging" >> $GITHUB_ENV | |
echo "BUILD_NUMBER_PREFIX=10" >> $GITHUB_ENV | |
echo "BUILD_VERSION_SUFFIX=-beta" >> $GITHUB_ENV | |
- name: Pre-checks - Env is PROD | |
if: ${{ env.TARGET_BRANCH == 'next' }} | |
run: | | |
echo "ENV=prod" >> $GITHUB_ENV | |
echo "APPCENTER_NAME=GoodDollar/GoodDollar-Android-production" >> $GITHUB_ENV | |
echo "APPCENTER_STORE=Production" >> $GITHUB_ENV | |
echo "BUILD_NUMBER_PREFIX=" >> $GITHUB_ENV | |
echo "BUILD_VERSION_SUFFIX=" >> $GITHUB_ENV | |
- uses: actions/checkout@v3 | |
with: | |
ref: ${{ env.TARGET_BRANCH }} | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
cache: 'yarn' | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: '3.7.x' | |
- name: fix max_user_watches | |
run: | | |
echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p | |
- name: Cache & install dependencies | |
run: yarn --immutable | |
- name: add .env secrets | |
env: | |
SENTRYRC: ${{ secrets.sentryrc_file }} | |
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} | |
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }} | |
run: | | |
env_name="${{ env.ENV }}" | |
if [[ $env_name == "development" ]]; then | |
vercel_env_name="development" | |
vercel pull --yes --environment=$vercel_env_name --token=${{ secrets.VERCEL_TOKEN }} | |
elif [[ $env_name == "prod" ]]; then | |
vercel_env_name="production" | |
vercel pull --yes --environment=production --token=${{ secrets.VERCEL_TOKEN }} | |
else | |
vercel_env_name="preview" | |
vercel pull --yes --environment=$vercel_env_name --git-branch=$env_name --token=${{ secrets.VERCEL_TOKEN }} | |
fi | |
cat .vercel/.env.$vercel_env_name.local >> .env.$env_name | |
echo $env_name | |
echo "APPCENTER_TOKEN=$(grep -Po '(?<=^APPCENTER_ANDROID_TOKEN=)\S+' .env.$env_name)" >> $GITHUB_ENV | |
echo "APPCENTER_CODEPUSH_TOKEN=$(grep -Po '(?<=^APPCENTER_CODEPUSH_TOKEN=)\S+' .env.$env_name)" >> $GITHUB_ENV | |
cat .env.$env_name | |
echo "adding secrets to .env.$env_name file" | |
echo "$SENTRYRC" > android/sentry.properties | |
echo "REACT_APP_CODE_PUSH_KEY=$(grep -Po '(?<=^APPCENTER_CODEPUSH_TOKEN=)\S+' .env.$env_name)" >> .env.$env_name | |
- name: Setup google services file | |
run: echo "${{ secrets.ANDROID_GOOGLE_SERVICES}}" | base64 --decode > ./android/app/google-services.json | |
- name: Set release keystore | |
run: | | |
echo "${{ secrets.RELEASE_ANDROID_KEYSTORE }}" > release.keystore.asc | |
gpg -d --passphrase "${{ secrets.RELEASE_ANDROID_PASSPHRASE }}" --batch release.keystore.asc > android/app/release.keystore | |
- name: Build Android Release | |
env: | |
RELEASE_ANDROID_PASSPHRASE: ${{ secrets.RELEASE_ANDROID_PASSPHRASE }} | |
ENVFILE: '.env.${{ env.ENV }}' | |
BUILD_NUMBER: '${{ env.BUILD_NUMBER_PREFIX }}${{ github.run_number }}' | |
CODE_PUSH_DEPLOYMENT_KEY: ${{ env.APPCENTER_CODEPUSH_TOKEN }} | |
run: | | |
PACKAGE_VERSION=`node -pe "require('./package.json')['version']"` | |
BUILD_VERSION=${PACKAGE_VERSION}${{ env.BUILD_VERSION_SUFFIX }} | |
echo "Creating release using env: ${ENVFILE} build:${BUILD_NUMBER} version:${BUILD_VERSION} ${GITHUB_RUN_NUMBER} ${{ github.run_number }}" | |
yarn lingui:compile | |
yarn animation:assets | |
cd android && ./gradlew bundleRelease | |
- name: Build Universal APK | |
uses: skywall/universal-apk-builder@v1.0.1 | |
with: | |
aab_path: ${{ env.ANDROID_BUNDLE_PATH }} | |
keystore_path: './android/app/release.keystore' | |
keystore_password: ${{secrets.RELEASE_ANDROID_PASSPHRASE}} | |
keystore_alias: 'release-alias' | |
keystore_alias_password: ${{secrets.RELEASE_ANDROID_PASSPHRASE}} | |
- name: Deploy to App Center | |
run: | | |
echo "deploying to ${{ env.APPCENTER_NAME }} ${{ env.INPUT_APK_PATH }}" | |
npx appcenter distribute release --token "${{ env.APPCENTER_TOKEN }}" --app "${{ env.APPCENTER_NAME }}" --group "Collaborators" --file "${{ env.UNIVERSAL_APK_PATH }}" --release-notes "$(git log -1 --pretty=format:'%h %s')" --debug | |
- name: Distribute to stores - PROD only | |
if: ${{ env.ENV == 'prod' }} | |
run: | | |
npx appcenter distribute stores publish --token "${{ env.APPCENTER_TOKEN }}" --app "${{ env.APPCENTER_NAME }}" --store "${{ env.APPCENTER_STORE }}" --file "${{ env.ANDROID_BUNDLE_PATH }}" --release-notes "$(git log -1 --pretty=format:'%h %s')" |