publish sample application #46
Workflow file for this run
This file contains hidden or 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: publish sample application | |
on: | |
workflow_dispatch: | |
inputs: | |
platform: | |
description: 'Select target platform' | |
required: true | |
type: choice | |
options: | |
- All | |
- Android | |
- iOS | |
version: | |
description: 'version (optional)' | |
required: false | |
type: string | |
default: '' | |
env: | |
CACHE_NODE_MODULES_PATH: | | |
node_modules | |
packages/*/node_modules | |
sample/node_modules | |
jobs: | |
deploy-ios: | |
name: '[iOS] Deploy' | |
if: ${{ github.event.inputs.platform == 'iOS' || github.event.inputs.platform == 'All' }} | |
runs-on: macos-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '18' | |
cache: 'yarn' | |
- name: Setup Ruby | |
uses: ruby/setup-ruby@v1 | |
env: | |
BUNDLE_GEMFILE: ${{ github.workspace }}/sample/ios/Gemfile | |
with: | |
ruby-version: '3.0.6' | |
bundler-cache: true | |
- name: Get yarn lockfile hash | |
id: yarn-lock-hash | |
run: echo "hash=${{ hashFiles('**/yarn.lock') }}" >> $GITHUB_OUTPUT | |
- name: Cache node_modules | |
id: yarn-cache | |
uses: actions/cache@v4 | |
with: | |
path: ${{ env.CACHE_NODE_MODULES_PATH }} | |
key: ${{ runner.os }}-yarn-${{ steps.yarn-lock-hash.outputs.hash }} | |
restore-keys: | | |
${{ runner.os }}-yarn- | |
- name: Install dependencies | |
if: steps.yarn-cache.outputs.cache-hit != 'true' | |
run: yarn install --frozen-lockfile | |
- name: Cache CocoaPods | |
id: cocoapods-cache | |
uses: actions/cache@v4 | |
with: | |
path: sample/ios/Pods | |
key: ${{ runner.os }}-pods-${{ hashFiles('sample/ios/Podfile.lock') }} | |
restore-keys: | | |
${{ runner.os }}-pods- | |
- name: Install CocoaPods | |
if: steps.cocoapods-cache.outputs.cache-hit != 'true' | |
working-directory: sample/ios | |
run: bundle exec pod install | |
- name: Create env.ts | |
run: echo "export const APP_ID = '${{ secrets.SENDBIRD_APP_ID }}';" >> sample/src/env.ts | |
- name: Run fastlane iOS | |
env: | |
APP_VERSION: ${{ github.event.inputs.version }} | |
MATCH_PASSWORD: ${{ secrets.FASTLANE_IOS_MATCH_PASSWORD }} | |
MATCH_GIT_URL: ${{ secrets.FASTLANE_IOS_MATCH_GIT_URL }} | |
PILOT_USERNAME: ${{ secrets.FASTLANE_IOS_APPLE_ID }} | |
PILOT_APPLE_ID: ${{ secrets.FASTLANE_IOS_TEAM_ID }} | |
PILOT_DEV_PORTAL_TEAM_ID: ${{ secrets.FASTLANE_IOS_TEAM_ID }} | |
PILOT_ITC_PROVIDER: ${{ secrets.FASTLANE_IOS_TEAM_ID }} | |
PILOT_SKIP_WAITING_FOR_BUILD_PROCESSING: true | |
FASTLANE_APPLE_APPLICATION_SPECIFIC_PASSWORD: ${{ secrets.FASTLANE_IOS_APPLE_APPLICATION_SPECIFIC_PASSWORD }} | |
run: | | |
if [ -n "$APP_VERSION" ]; then | |
yarn deploy:ios version:$APP_VERSION | |
else | |
yarn deploy:ios | |
fi | |
deploy-android: | |
name: '[Android] Deploy' | |
if: ${{ github.event.inputs.platform == 'Android' || github.event.inputs.platform == 'All' }} | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '18' | |
cache: 'yarn' | |
- name: Setup Java | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'temurin' | |
java-version: '17' | |
- name: Install Ninja | |
run: sudo apt-get update && sudo apt-get install -y ninja-build | |
- name: Setup Ruby | |
uses: ruby/setup-ruby@v1 | |
env: | |
BUNDLE_GEMFILE: ${{ github.workspace }}/sample/android/Gemfile | |
with: | |
ruby-version: '2.7.6' | |
bundler-cache: true | |
- name: Get yarn lockfile hash | |
id: yarn-lock-hash | |
run: echo "hash=${{ hashFiles('**/yarn.lock') }}" >> $GITHUB_OUTPUT | |
- name: Cache node_modules | |
id: yarn-cache | |
uses: actions/cache@v4 | |
with: | |
path: ${{ env.CACHE_NODE_MODULES_PATH }} | |
key: ${{ runner.os }}-yarn-${{ steps.yarn-lock-hash.outputs.hash }} | |
restore-keys: | | |
${{ runner.os }}-yarn- | |
- name: Install dependencies | |
if: steps.yarn-cache.outputs.cache-hit != 'true' | |
run: yarn install --frozen-lockfile | |
- name: Create env.ts | |
run: echo "export const APP_ID = '${{ secrets.SENDBIRD_APP_ID }}';" >> sample/src/env.ts | |
- name: Set up trusted certificates | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y ca-certificates | |
echo 'SSL_CERT_FILE=/etc/ssl/certs/ca-certificates.crt' >> $GITHUB_ENV | |
- name: Create service-account.json | |
env: | |
FASTLANE_ANDROID_SERVICE_ACCOUNT: ${{ secrets.FASTLANE_ANDROID_SERVICE_ACCOUNT }} | |
FASTLANE_ANDROID_APP_ID: ${{ secrets.FASTLANE_ANDROID_APP_ID }} | |
run: | | |
FILE_PATH="sample/android/fastlane/service-account.json" | |
echo "$FASTLANE_ANDROID_SERVICE_ACCOUNT" | base64 --decode > $FILE_PATH | |
echo "GOOGLE_APPLICATION_CREDENTIALS=$GITHUB_WORKSPACE/$FILE_PATH" >> $GITHUB_ENV | |
echo "FIREBASEAPPDISTRO_APP=$FASTLANE_ANDROID_APP_ID" >> $GITHUB_ENV | |
- name: Run fastlane Android | |
env: | |
APP_VERSION: ${{ github.event.inputs.version }} | |
run: | | |
if [ -n "$APP_VERSION" ]; then | |
yarn deploy:android version:$APP_VERSION | |
else | |
yarn deploy:android | |
fi |