CICD-Mobile-App-Release-GitHub/.github/workflows/deploy_to_playstore_testflight.yml

146 lines
5.5 KiB
YAML

name: Deploy to Play Store Internal & TestFlight
on:
workflow_dispatch:
inputs:
skipBuildNumberIncrease:
description: 'Skip automatic build number increase'
type: boolean
default: false
jobs:
android-publish-to-play-store:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
cache: 'npm'
- name: node_modules cache
uses: actions/cache@v3
id: npm-cache
with:
path: node_modules
key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}
restore-keys: ${{ runner.os }}-npm-
- name: Install Dependencies
run: npm ci
- name: Set up Ruby & Fastlane
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.2.1'
bundler-cache: true
working-directory: ./android
- name: Setup Java
uses: actions/setup-java@v3
with:
distribution: 'adopt'
java-version: '11'
# caching currently disabled, because the files are large, but don't decrease built time too much
#cache: gradle
- name: Restore Release Keystore
env:
keystore_base64: ${{ secrets.CI_EVAL_ANDROID_KEYSTORE_BASE64 }}
run: |
echo "$keystore_base64" | base64 --decode > release.keystore
echo "CI_EVAL_ANDROID_KEYSTORE_FILE=`pwd`/release.keystore" >> $GITHUB_ENV
- name: Restore PlayStore Service Account
env:
play_store_service_account_base64: ${{ secrets.CI_EVAL_ANDROID_PLAY_STORE_AUTH_BASE64 }}
run: |
echo "$play_store_service_account_base64" | base64 --decode > play-store-distribution-service-account.json
echo "CI_EVAL_ANDROID_PLAY_STORE_AUTH_FILE=`pwd`/play-store-distribution-service-account.json" >> $GITHUB_ENV
- name: Prod .ENV File
env:
ENV_FILE_CONTENT: ${{ secrets.CI_PROD_ENV_FILE_CONTENT }}
run: echo "$ENV_FILE_CONTENT" > .env
- name: Deploy to Play Store Internal Track
env:
CI_EVAL_ANDROID_KEYSTORE_KEY_ALIAS: ${{ secrets.CI_EVAL_ANDROID_KEYSTORE_KEY_ALIAS }}
CI_EVAL_ANDROID_KEYSTORE_KEY_PASSWORD: ${{ secrets.CI_EVAL_ANDROID_KEYSTORE_KEY_PASSWORD }}
CI_EVAL_ANDROID_KEYSTORE_STORE_PASSWORD: ${{ secrets.CI_EVAL_ANDROID_KEYSTORE_STORE_PASSWORD }}
working-directory: ./android
run: bundle exec fastlane deployProdToPlayStore skip_build_number_increase:${{ github.event.inputs.skipBuildNumberIncrease }}
ios-publish-to-testflight:
runs-on: macos-latest
permissions:
contents: read
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
cache: 'npm'
- name: node_modules cache
uses: actions/cache@v3
id: npm-cache
with:
path: node_modules
key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}
restore-keys: ${{ runner.os }}-npm-
- name: Install Dependencies
run: npm ci
- name: Set up Ruby & Fastlane
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.2.1'
bundler-cache: true
working-directory: ./ios
- name: pod install cache
uses: actions/cache@v3
id: pod-cache
with:
path: ios/Pods
key: ${{ runner.os }}-pod-${{ hashFiles('ios/Podfile.lock') }}
restore-keys: ${{ runner.os }}-pod-
- name: Install iOS Dependencies
working-directory: ./ios
run: pod install
- name: Restore Prod Provisioning Profile
env:
provision_profile_base64: ${{ secrets.CI_EVAL_IOS_PROVISIONING_PROFILE_PROD_BASE64 }}
run: |
mkdir -p ~/Library/MobileDevice/Provisioning\ Profiles
echo "$provision_profile_base64" | base64 --decode > ~/Library/MobileDevice/Provisioning\ Profiles/prod_profile.mobileprovision
echo "CI_EVAL_IOS_PROVISIONING_PROFILE_PROD_FILENAME=prod_profile.mobileprovision" >> $GITHUB_ENV
- name: Restore iOS Cert
env:
ios_cert_base64: ${{ secrets.CI_EVAL_IOS_CERT_BASE64 }}
run: |
echo "$ios_cert_base64" | base64 --decode > ios_distribution.p12
echo "CI_EVAL_IOS_CERT_FILE=`pwd`/ios_distribution.p12" >> $GITHUB_ENV
- name: Restore App Store API Key
env:
app_store_api_key_base64: ${{ secrets.CI_EVAL_IOS_APP_STORE_KEY_FILE_BASE64 }}
run: |
echo "$app_store_api_key_base64" | base64 --decode > api_key.p8
echo "CI_EVAL_IOS_APP_STORE_KEY_FILE=`pwd`/api_key.p8" >> $GITHUB_ENV
- name: Prod .ENV File
env:
ENV_FILE_CONTENT: ${{ secrets.CI_PROD_ENV_FILE_CONTENT }}
run: echo "$ENV_FILE_CONTENT" > .env
- name: Deploy to TestFlight
env:
CI_EVAL_IOS_CERT_PASSWORD: ${{ secrets.CI_EVAL_IOS_CERT_PASSWORD }}
CI_EVAL_IOS_APP_STORE_KEY_ID: ${{ secrets.CI_EVAL_IOS_APP_STORE_KEY_ID }}
CI_EVAL_IOS_APP_STORE_KEY_ISSUER_ID: ${{ secrets.CI_EVAL_IOS_APP_STORE_KEY_ISSUER_ID }}
CI_EVAL_PROD_APP_IDENTIFIER: ${{ secrets.CI_EVAL_PROD_APP_IDENTIFIER }}
working-directory: ./ios
run: bundle exec fastlane deployToTestFlight skip_build_number_increase:${{ github.event.inputs.skipBuildNumberIncrease }}