pro-2.0.7+133~mainguyen-liberty #105
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: Apple Pen | |
on: | |
repository_dispatch: | |
types: | |
- ppap | |
- stg-* | |
- pro-* | |
env: | |
NO_FLIPPER: 1 | |
LC_ALL: en_US.UTF-8 | |
LANG: en_US.UTF-8 | |
# BUILD ENVIRONMENT FILE | |
API_KEY_JSON: ${{ secrets.API_KEY_JSON }} | |
FIREBASE_CLI_TOKEN: ${{secrets.FIREBASE_CLI_TOKEN}} | |
DYNAMIC_CONSTANTS_TS_PROD_BASE64: ${{ secrets.DYNAMIC_CONSTANTS_TS_PROD_BASE64 }} | |
PRO_RELEASE_KEYSTORE_BASE64: ${{ secrets.PRO_RELEASE_KEYSTORE_BASE64 }} | |
PRO_GOOGLE_SERVICES_JSON: ${{ secrets.PRO_GOOGLE_SERVICES_JSON }} | |
PRO_GOOGLESERVICE_INFO_PLIST: ${{ secrets.PRO_GOOGLESERVICE_INFO_PLIST }} | |
# BUILD ENVIRONMENT VARIABLE | |
REF_NAME: ${{github.event.client_payload.ref_name}} | |
P12_PASSWORD: ${{ secrets.P12_PASSWORD }} | |
# TELEGRAM | |
TELEGRAM_GROUP_ID: ${{secrets.TELEGRAM_GROUP_ID}} | |
TELEGRAM_TOPIC_ID: ${{secrets.TELEGRAM_TOPIC_ID}} | |
TELEGRAM_BOT_TOKEN: ${{secrets.TELEGRAM_BOT_TOKEN}} | |
BUILD_IPA_ENABLED: true | |
BUILD_APK_ENABLED: true | |
BUILD_AAB_ENABLED: ${{true && github.event.client_payload.build_env == 'pro'}} | |
defaults: | |
run: | |
shell: bash -leo pipefail {0} | |
jobs: | |
init: | |
name: Init Deployment | |
runs-on: macos-14 | |
outputs: | |
matrix: ${{ steps.set-matrix.outputs.value }} | |
# message-information: ${{ steps.get-message-information.outputs.value }} | |
env: ${{ steps.set-env.outputs.value }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
repository: ${{secrets.MAIN_REPOSITORY}} | |
token: ${{secrets.GH_PAT}} | |
ref: ${{github.event.client_payload.ref_name}} | |
- name: Load Build Environment | |
id: set-env | |
run: | | |
bash scripts/load_build_environment.sh | |
echo "value=$BUILD_ENV" >> $GITHUB_OUTPUT | |
- name: Set matrix | |
id: set-matrix | |
run: | | |
MATRIX="[{\"format\":\"IPA\",\"name\":\"macos-14\",\"platform\":\"IOS\"},{\"format\":\"APK\",\"name\":\"ubuntu-22.04\",\"platform\":\"ANDROID\"}]" | |
if [[ "$BUILD_ENV" == "pro" ]]; then | |
MATRIX="[{\"format\":\"IPA\",\"name\":\"macos-14\",\"platform\":\"IOS\"},{\"format\":\"APK\",\"name\":\"ubuntu-22.04\",\"platform\":\"ANDROID\"},{\"format\":\"AAB\",\"name\":\"ubuntu-22.04\",\"platform\":\"ANDROID\"}]" | |
fi | |
echo "value=$MATRIX" >> $GITHUB_OUTPUT | |
# - name: Send telegram message | |
# uses: ./.github/actions/send-telegram-message | |
# timeout-minutes: 1 | |
# with: | |
# APP_NAME: Liberty Exchange Customer | |
# MESSAGE_TITLE: Setup bản build mới... | |
prepare: | |
name: Prepare ${{matrix.platform}} | |
continue-on-error: true | |
needs: [init] | |
strategy: | |
fail-fast: true | |
matrix: | |
include: | |
- name: "macos-14" | |
platform: "IOS" | |
- name: "ubuntu-22.04" | |
platform: "ANDROID" | |
runs-on: ${{ matrix.name }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
repository: ${{secrets.MAIN_REPOSITORY}} | |
token: ${{secrets.GH_PAT}} | |
ref: ${{github.event.client_payload.ref_name}} | |
- name: Setup Node Version | |
uses: actions/setup-node@v4 | |
with: | |
node-version: "18" | |
- name: Cache node_modules | |
id: cache-node-modules | |
uses: actions/cache@v4 | |
with: | |
path: node_modules | |
key: ${{ matrix.platform }}-cache-node-modules-${{ hashFiles('yarn.lock') }} | |
lookup-only: true | |
- name: Unlock ssh agent | |
uses: webfactory/ssh-agent@v0.9.0 | |
with: | |
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY_SDK_CORE_CLIENT }} | |
- name: Run yarn install | |
if: steps.cache-node-modules.outputs.cache-hit != 'true' | |
uses: borales/actions-yarn@v5 | |
with: | |
cmd: install --network-concurrency 1 | |
deploy: | |
name: Deployment | |
continue-on-error: true | |
needs: [init, prepare] | |
strategy: | |
fail-fast: true | |
matrix: | |
include: ${{ fromJson(needs.init.outputs.matrix) }} | |
runs-on: ${{ matrix.name }} | |
timeout-minutes: 60 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
repository: ${{secrets.MAIN_REPOSITORY}} | |
token: ${{secrets.GH_PAT}} | |
ref: ${{github.event.client_payload.ref_name}} | |
# NOTE: Setup Build Environment | |
- name: Setup ruby 3.0.0 | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: "3.0.0" | |
bundler-cache: true | |
- name: Setup Node v18 | |
uses: actions/setup-node@v4 | |
with: | |
node-version: "18" | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v4 | |
if: matrix.platform == 'ANDROID' | |
with: | |
java-version: "17" | |
distribution: "temurin" | |
cache: "gradle" | |
- name: Setup Android SDK | |
if: matrix.platform == 'ANDROID' | |
uses: android-actions/setup-android@v3 | |
- name: Setup Android NDK | |
uses: nttld/setup-ndk@v1 | |
if: matrix.platform == 'ANDROID' | |
with: | |
ndk-version: r26c | |
- name: Setup cocoapods | |
if: matrix.platform == 'IOS' | |
uses: maxim-lobanov/setup-cocoapods@v1 | |
with: | |
version: 1.15.2 | |
- name: Select Xcode | |
if: matrix.platform == 'IOS' | |
uses: maxim-lobanov/setup-xcode@v1 | |
with: | |
xcode-version: "15.3" | |
# NOTE: Install Libs | |
- name: Cache node_modules | |
id: cache-node-modules | |
uses: actions/cache@v4 | |
with: | |
path: node_modules | |
key: ${{ matrix.platform }}-cache-node-modules-${{ hashFiles('yarn.lock') }} | |
- name: Cache Pods | |
if: matrix.platform == 'IOS' | |
id: cache-pods | |
uses: actions/cache@v4 | |
with: | |
path: | | |
ios/Pods | |
ios/Podfile.lock | |
key: cache-pods-${{ hashFiles('yarn.lock') }} | |
- name: Pod install | |
if: ${{ (matrix.platform == 'IOS') && (steps.cache-pods.outputs.cache-hit != 'true') }} | |
working-directory: ios | |
run: pod install | |
- name: Cache Xcode build | |
uses: irgaly/xcode-cache@v1 | |
if: matrix.platform == 'IOS' | |
with: | |
key: xcode-cache-deriveddata-${{ needs.init.outputs.env }}-${{ hashFiles('yarn.lock') }} | |
restore-keys: xcode-cache-deriveddata-${{ needs.init.outputs.env }}- | |
# NOTE: Load Environment Variable | |
- name: Load Build Environment | |
run: bash scripts/load_build_environment.sh | |
- name: Load Secret Files | |
run: bash scripts/load_secret_file.sh | |
- name: Config Environment | |
run: bash scripts/load_build_configuration.sh | |
- name: Change Version And Build Number | |
run: bash scripts/load_build_version.sh | |
- name: Generate launcher icon | |
uses: borales/actions-yarn@v5 | |
with: | |
cmd: appicon:create | |
- name: Install certificate and provision | |
if: matrix.platform == 'IOS' | |
run: bash scripts/load_cert_and_provision.sh | |
- name: Link Node (/usr/local/bin/node) | |
if: matrix.platform == 'IOS' | |
run: ln -s $(command -v node) /usr/local/bin/node | |
# NOTE: start build | |
- name: Build IPA | |
if: matrix.format == 'IPA' | |
uses: maierj/fastlane-action@v3.1.0 | |
with: | |
lane: ios build_ios | |
- name: Build APK | |
if: matrix.format == 'APK' | |
uses: maierj/fastlane-action@v3.1.0 | |
with: | |
lane: android build_android_apk | |
- name: Build AAB | |
if: matrix.format == 'AAB' | |
uses: maierj/fastlane-action@v3.1.0 | |
with: | |
lane: android build_android_aab | |
# NOTE: deploy | |
- name: Deploy ipa | |
if: matrix.format == 'IPA' | |
uses: maierj/fastlane-action@v3.1.0 | |
with: | |
lane: ios deploy_ios | |
- name: Deploy APK to firebase | |
if: matrix.format == 'APK' | |
uses: maierj/fastlane-action@v3.1.0 | |
with: | |
lane: android deploy_android_apk | |
- name: Deploy AAB to playstore | |
if: matrix.format == 'AAB' | |
uses: maierj/fastlane-action@v3.1.0 | |
with: | |
lane: android deploy_android_aab | |
# - name: Send telegram message | |
# if: vars.IS_SILENT != 'true' | |
# uses: PacificPromise/macos-telegram-action@main | |
# with: | |
# type: topic | |
# message: "✅ - Success ${{ matrix.format }}: ${{ needs.init.outputs.message-information }}" | |
# - name: Send telegram message failure | |
# if: ${{ failure() && vars.IS_SILENT != 'true' }} | |
# uses: PacificPromise/macos-telegram-action@main | |
# with: | |
# type: topic | |
# message: "💥 - Failure ${{ matrix.format }}: ${{ needs.init.outputs.message-information }}" | |