Skip to content

publish sample application #76

publish sample application

publish sample application #76

Workflow file for this run

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.1'
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
env:
APP_ID: ${{ secrets.SENDBIRD_APP_ID }}
run: echo "export const APP_ID = '$APP_ID';" >> sample/src/env.ts
- name: Setup SSH for match
env:
SSH_PRIVATE_KEY: ${{ secrets.FASTLANE_IOS_MATCH_GIT_PRIVATE_KEY }}
run: |
mkdir -p ~/.ssh
echo "$SSH_PRIVATE_KEY" > ~/.ssh/match_key
chmod 600 ~/.ssh/match_key
ssh-keyscan github.com >> ~/.ssh/known_hosts
cat >> ~/.ssh/config << EOF
Host github.com
User git
IdentityFile ~/.ssh/match_key
IdentitiesOnly yes
EOF
chmod 600 ~/.ssh/config
- 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 }}
APP_STORE_CONNECT_API_KEY_ID: ${{ secrets.APP_STORE_CONNECT_API_KEY_ID }}
APP_STORE_CONNECT_API_ISSUER_ID: ${{ secrets.APP_STORE_CONNECT_API_ISSUER_ID }}
APP_STORE_CONNECT_API_KEY: ${{ secrets.APP_STORE_CONNECT_API_KEY }}
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