This repository has been archived by the owner on Aug 30, 2024. It is now read-only.
Merge branch 'android-target-api33' of github.com:dolbyio-samples/com… #148
Workflow file for this run
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
name: CD Android build and distribution | |
on: | |
push: | |
branches: | |
- main | |
- android-target-api33 | |
tags: | |
- '*' | |
jobs: | |
Android-App-Build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout source code | |
uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 16 | |
- name: Install modules | |
run: yarn install | |
- name: Set up JDK 11 | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'zulu' | |
java-version: 11 | |
- name: Cache Gradle Wrapper | |
uses: actions/cache@v3 | |
with: | |
path: ~/.gradle/wrapper | |
key: ${{ runner.os }}-gradle-wrapper-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }} | |
- name: Install the signing certificate | |
env: | |
DISTRIBUTION_CERTIFICATE_ANDROID_BASE64: ${{ secrets.RELEASE_KEYSTORE_BASE64 }} | |
run: | | |
CERTIFICATE_PATH=./examples/mobile/android/app/release.keystore | |
echo -n "$DISTRIBUTION_CERTIFICATE_ANDROID_BASE64" | base64 --decode > $CERTIFICATE_PATH | |
- name: calculate version | |
run: | | |
versionName='1.0.'$GITHUB_RUN_NUMBER | |
versionCode=$GITHUB_RUN_NUMBER; echo "versionName: $versionName; versionCode: $versionCode" | |
echo "export VERSION_NAME=$versionName; export VERSION_CODE=$versionCode" > ~/.env_version | |
- name: Beta Android App Build | |
env: | |
KEYSTORE_PASSWORD: ${{ secrets.RELEASE_KEYSTORE_STORE_PASSWORD }} | |
KEY_ALIAS: ${{ secrets.RELEASE_KEYSTORE_KEY_ALIAS }} | |
KEY_PASSWORD: ${{ secrets.RELEASE_KEYSTORE_KEY_PASSWORD }} | |
run: | | |
export KEYSTORE_PASSWORD=$KEYSTORE_PASSWORD | |
export KEY_ALIAS=$KEY_ALIAS | |
export KEY_PASSWORD=$KEY_PASSWORD | |
source ~/.env_version | |
cd examples/mobile/android && chmod +x ./gradlew && ./gradlew assembleProdRelease bundleProdRelease | |
- name: Archive production apk | |
uses: actions/upload-artifact@v3 | |
with: | |
name: android-release-apk | |
path: | | |
./examples/mobile/android/app/build/outputs/apk/prod/release | |
retention-days: 3 | |
- name: Archive production bundle | |
uses: actions/upload-artifact@v3 | |
with: | |
name: android-release-bundle | |
path: | | |
./examples/mobile/android/app/build/outputs/bundle/prodRelease/app-prod-release.aab | |
Android-Firebase-Distribution: | |
needs: Android-App-Build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout source code | |
uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 16 | |
- name: Install modules | |
run: yarn install | |
- name: Set up JDK 11 | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'zulu' | |
java-version: 11 | |
- name: Cache Gradle Wrapper | |
uses: actions/cache@v3 | |
with: | |
path: ~/.gradle/wrapper | |
key: ${{ runner.os }}-gradle-wrapper-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }} | |
- name: Download release artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
name: android-release-apk | |
path: ./examples/mobile/android/app/build/outputs/apk/prod/release | |
- name: calculate version | |
run: | | |
versionName='1.0.'$GITHUB_RUN_NUMBER | |
versionCode=$GITHUB_RUN_NUMBER; | |
echo "export VERSION_NAME=$versionName; export VERSION_CODE=$versionCode" > ~/.env_version | |
- name: Deploy to Firebase | |
env: | |
FIREBASE_APP_ID_ANDROID: ${{secrets.FIREBASE_APP_ID_ANDROID}} | |
GOOGLE_APPLICATION_CREDENTIALS_KEY: ${{secrets.GOOGLE_APPLICATION_CREDENTIALS}} | |
run: | | |
echo $GOOGLE_APPLICATION_CREDENTIALS_KEY >> $GITHUB_WORKSPACE/google-app-creds.json | |
export FIREBASE_APP_ID=$FIREBASE_APP_ID_ANDROID | |
export GOOGLE_APPLICATION_CREDENTIALS=$GITHUB_WORKSPACE/google-app-creds.json | |
source ~/.env_version | |
cd examples/mobile/android && chmod +x ./gradlew && ./gradlew appDistributionUploadProdRelease --stacktrace | |
Android-Play-Store-Distribution: | |
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/') | |
needs: Android-App-Build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout source code | |
uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 16 | |
- name: Install modules | |
run: yarn install | |
- name: Set up JDK 11 | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'zulu' | |
java-version: 11 | |
- name: Cache Gradle Wrapper | |
uses: actions/cache@v3 | |
with: | |
path: ~/.gradle/wrapper | |
key: ${{ runner.os }}-gradle-wrapper-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }} | |
- name: Download release artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
name: android-release-bundle | |
path: ./examples/mobile/android/app/build/outputs/bundle/prodRelease/ | |
- name: Deploy to Play Store | |
env: | |
ANDROID_PUBLISHER_CREDENTIALS: ${{ secrets.ANDROID_PUBLISHER_CREDENTIALS }} | |
run: | | |
export ANDROID_PUBLISHER_CREDENTIALS=$ANDROID_PUBLISHER_CREDENTIALS | |
cd examples/mobile/android && chmod +x ./gradlew && ./gradlew publishProdReleaseBundle --artifact-dir ./app/build/outputs/bundle/prodRelease/ --stacktrace | |
Android-App-Internal-Build-And-Distribute-To-Play-Store: | |
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/') | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout source code | |
uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 16 | |
- name: Install modules | |
run: yarn install | |
- name: Set up JDK 11 | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'zulu' | |
java-version: 11 | |
- name: Cache Gradle Wrapper | |
uses: actions/cache@v3 | |
with: | |
path: ~/.gradle/wrapper | |
key: ${{ runner.os }}-gradle-wrapper-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }} | |
- name: Install the signing certificate | |
env: | |
DISTRIBUTION_CERTIFICATE_ANDROID_BASE64: ${{ secrets.RELEASE_KEYSTORE_BASE64 }} | |
run: | | |
CERTIFICATE_PATH=./examples/mobile/android/app/release.keystore | |
echo -n "$DISTRIBUTION_CERTIFICATE_ANDROID_BASE64" | base64 --decode > $CERTIFICATE_PATH | |
- name: calculate version | |
run: | | |
versionName='1.0.'$GITHUB_RUN_NUMBER | |
versionCode=$GITHUB_RUN_NUMBER; echo "versionName: $versionName; versionCode: $versionCode" | |
echo "export VERSION_NAME=$versionName; export VERSION_CODE=$versionCode" > ~/.env_version | |
- name: Assign internal environment | |
env: | |
# `INTERNAL_RELEASE_TOKEN_URLS` are used just in Internal Test Builds only. | |
# Writes Test Server URL's into the source files which on runtime is used for fetching test Access Token's in the App. | |
# Targeted users for the build - Business stakeholders within the Organisation | |
INTERNAL_RELEASE_TOKEN_URLS: ${{secrets.INTERNAL_RELEASE_TOKEN_URLS}} | |
run: | | |
echo $INTERNAL_RELEASE_TOKEN_URLS > packages/mobile/src/providers/TokenUrl.tsx | |
- name: Internal Android App Build | |
env: | |
KEYSTORE_PASSWORD: ${{ secrets.RELEASE_KEYSTORE_STORE_PASSWORD }} | |
KEY_ALIAS: ${{ secrets.RELEASE_KEYSTORE_KEY_ALIAS }} | |
KEY_PASSWORD: ${{ secrets.RELEASE_KEYSTORE_KEY_PASSWORD }} | |
run: | | |
export KEYSTORE_PASSWORD=$KEYSTORE_PASSWORD | |
export KEY_ALIAS=$KEY_ALIAS | |
export KEY_PASSWORD=$KEY_PASSWORD | |
source ~/.env_version | |
cd examples/mobile/android && chmod +x ./gradle && ./gradlew assembleInternalRelease bundleInternalRelease --stacktrace | |
- name: Deploy to Play Store | |
env: | |
ANDROID_PUBLISHER_CREDENTIALS: ${{ secrets.ANDROID_PUBLISHER_CREDENTIALS }} | |
run: | | |
export ANDROID_PUBLISHER_CREDENTIALS=$ANDROID_PUBLISHER_CREDENTIALS | |
cd examples/mobile/android && chmod +x ./gradlew && ./gradlew publishInternalReleaseBundle --artifact-dir ./app/build/outputs/bundle/internalRelease/ --stacktrace |