@@ -17,130 +17,149 @@ on:
1717 type : string
1818 default : ' '
1919
20+ env :
21+ CACHE_NODE_MODULES_PATH : |
22+ node_modules
23+ packages/*/node_modules
24+ sample/node_modules
25+
2026jobs :
21- execute :
27+ deploy-ios :
28+ name : ' [iOS] Deploy'
29+ if : ${{ github.event.inputs.platform == 'iOS' || github.event.inputs.platform == 'All' }}
30+ runs-on : macos-latest
31+ steps :
32+ - uses : actions/checkout@v4
33+
34+ - name : Setup Node.js
35+ uses : actions/setup-node@v4
36+ with :
37+ node-version : ' 18'
38+ cache : ' yarn'
39+
40+ - name : Setup Ruby
41+ uses : ruby/setup-ruby@v1
42+ env :
43+ BUNDLE_GEMFILE : ${{ github.workspace }}/sample/ios/Gemfile
44+ with :
45+ ruby-version : ' 3.1'
46+ bundler-cache : true
47+
48+ - name : Install dependencies
49+ run : yarn install --frozen-lockfile
50+
51+ - name : Install CocoaPods
52+ working-directory : sample/ios
53+ run : bundle exec pod install
54+
55+ - name : Create env.ts
56+ env :
57+ APP_ID : ${{ secrets.SENDBIRD_APP_ID }}
58+ run : echo "export const APP_ID = '$APP_ID';" >> sample/src/env.ts
59+
60+ - name : Setup SSH for match
61+ env :
62+ SSH_PRIVATE_KEY : ${{ secrets.FASTLANE_IOS_MATCH_GIT_PRIVATE_KEY }}
63+ run : |
64+ mkdir -p ~/.ssh
65+ echo "$SSH_PRIVATE_KEY" > ~/.ssh/match_key
66+ chmod 600 ~/.ssh/match_key
67+ ssh-keyscan github.com >> ~/.ssh/known_hosts
68+ cat >> ~/.ssh/config << EOF
69+ Host github.com
70+ User git
71+ IdentityFile ~/.ssh/match_key
72+ IdentitiesOnly yes
73+ EOF
74+ chmod 600 ~/.ssh/config
75+
76+ - name : Run fastlane iOS
77+ env :
78+ APP_VERSION : ${{ github.event.inputs.version }}
79+ MATCH_PASSWORD : ${{ secrets.FASTLANE_IOS_MATCH_PASSWORD }}
80+ MATCH_GIT_URL : ${{ secrets.FASTLANE_IOS_MATCH_GIT_URL }}
81+ APP_STORE_CONNECT_API_KEY_ID : ${{ secrets.APP_STORE_CONNECT_API_KEY_ID }}
82+ APP_STORE_CONNECT_API_ISSUER_ID : ${{ secrets.APP_STORE_CONNECT_API_ISSUER_ID }}
83+ APP_STORE_CONNECT_API_KEY : ${{ secrets.APP_STORE_CONNECT_API_KEY }}
84+ run : |
85+ if [ -n "$APP_VERSION" ]; then
86+ yarn deploy:ios version:$APP_VERSION
87+ else
88+ yarn deploy:ios
89+ fi
90+
91+ deploy-android :
92+ name : ' [Android] Deploy'
93+ if : ${{ github.event.inputs.platform == 'Android' || github.event.inputs.platform == 'All' }}
2294 runs-on : ubuntu-latest
2395 steps :
24- - name : Set BRANCH_NAME env
25- run : echo "BRANCH_NAME=${GITHUB_REF#refs/heads/}" >> $GITHUB_ENV
96+ - uses : actions/checkout@v4
97+
98+ - name : Setup Node.js
99+ uses : actions/setup-node@v4
100+ with :
101+ node-version : ' 18'
102+ cache : ' yarn'
103+
104+ - name : Setup Java
105+ uses : actions/setup-java@v4
106+ with :
107+ distribution : ' temurin'
108+ java-version : ' 17'
109+
110+ - name : Install Ninja
111+ run : sudo apt-get update && sudo apt-get install -y ninja-build
112+
113+ - name : Setup Ruby
114+ uses : ruby/setup-ruby@v1
115+ env :
116+ BUNDLE_GEMFILE : ${{ github.workspace }}/sample/android/Gemfile
117+ with :
118+ ruby-version : ' 2.7.6'
119+ bundler-cache : true
120+
121+ - name : Get yarn lockfile hash
122+ id : yarn-lock-hash
123+ run : echo "hash=${{ hashFiles('**/yarn.lock') }}" >> $GITHUB_OUTPUT
124+
125+ - name : Cache node_modules
126+ id : yarn-cache
127+ uses : actions/cache@v4
128+ with :
129+ path : ${{ env.CACHE_NODE_MODULES_PATH }}
130+ key : ${{ runner.os }}-yarn-${{ steps.yarn-lock-hash.outputs.hash }}
131+ restore-keys : |
132+ ${{ runner.os }}-yarn-
133+
134+ - name : Install dependencies
135+ if : steps.yarn-cache.outputs.cache-hit != 'true'
136+ run : yarn install --frozen-lockfile
137+
138+ - name : Create env.ts
139+ run : echo "export const APP_ID = '${{ secrets.SENDBIRD_APP_ID }}';" >> sample/src/env.ts
140+
141+ - name : Set up trusted certificates
142+ run : |
143+ sudo apt-get update
144+ sudo apt-get install -y ca-certificates
145+ echo 'SSL_CERT_FILE=/etc/ssl/certs/ca-certificates.crt' >> $GITHUB_ENV
146+
147+ - name : Create service-account.json
148+ env :
149+ FASTLANE_ANDROID_SERVICE_ACCOUNT : ${{ secrets.FASTLANE_ANDROID_SERVICE_ACCOUNT }}
150+ FASTLANE_ANDROID_APP_ID : ${{ secrets.FASTLANE_ANDROID_APP_ID }}
151+ run : |
152+ FILE_PATH="sample/android/fastlane/service-account.json"
153+ echo "$FASTLANE_ANDROID_SERVICE_ACCOUNT" | base64 --decode > $FILE_PATH
154+ echo "GOOGLE_APPLICATION_CREDENTIALS=$GITHUB_WORKSPACE/$FILE_PATH" >> $GITHUB_ENV
155+ echo "FIREBASEAPPDISTRO_APP=$FASTLANE_ANDROID_APP_ID" >> $GITHUB_ENV
26156
27- - name : ' [${{ github.event.inputs.platform }}] Deploy trigger (CircleCI REST API)'
28- if : ${{ github.event.inputs.platform }}
157+ - name : Run fastlane Android
29158 env :
30- CIRCLECI_PERSONAL_API_TOKEN : ${{ secrets.CIRCLECI_PERSONAL_API_TOKEN }}
31- BRANCH_NAME : ${{ env.BRANCH_NAME }}
32- PLATFORM : ${{ github.event.inputs.platform }}
33- VERSION : ${{ github.event.inputs.version }}
159+ APP_VERSION : ${{ github.event.inputs.version }}
34160 run : |
35- curl -u ${CIRCLECI_PERSONAL_API_TOKEN}: \
36- -X POST "https://circleci.com/api/v2/project/gh/sendbird/sendbird-uikit-react-native/pipeline" \
37- -H "Content-Type: application/json" \
38- -d '{
39- "branch": "'"${BRANCH_NAME}"'",
40- "parameters": {
41- "platform": "'"${PLATFORM}"'",
42- "version": "'"${VERSION}"'"
43- }
44- }'
45-
46- # env:
47- # CACHE_NODE_MODULES_PATH: |
48- # node_modules
49- # packages/*/node_modules
50- # sample/node_modules
51- #
52- # jobs:
53- # deploy-android:
54- # name: '[Android] Deploy'
55- # if: ${{ github.event.inputs.platform == 'Android' || github.event.inputs.platform == 'All' }}
56- # runs-on: ubuntu-latest
57- # steps:
58- # - uses: actions/checkout@v3
59- # - uses: actions/setup-node@v1
60- # with:
61- # node-version: 16.x
62- # - uses: ruby/setup-ruby@v1
63- # env:
64- # BUNDLE_GEMFILE: ${{ github.workspace }}/sample/android/Gemfile
65- # with:
66- # ruby-version: 2.7
67- # bundler-cache: true
68- # - name: Get lockfile hash
69- # id: lockfile_hash
70- # run: echo "::set-output name=hash::${{ hashFiles('**/yarn.lock') }}"
71- # - name: Check cached node_modules
72- # id: check_cache
73- # uses: actions/cache@v2
74- # with:
75- # path: ${{ env.CACHE_NODE_MODULES_PATH }}
76- # key: ${{ steps.lockfile_hash.outputs.hash }}
77- # - name: Install dependencies
78- # if: steps.check_cache.outputs.cache-hit == ''
79- # run: yarn install --frozen-lockfile
80- # - name: Create env.ts
81- # run:
82- # echo "export const APP_ID = '${{ secrets.sendbird_app_id }}';" >> sample/src/env.ts
83- #
84- # - name: Create service-account.json
85- # uses: /bang9/create-env-json@v3
86- # id: service-account
87- # with:
88- # file-name: './sample/android/fastlane/service-account.json'
89- # type: 'service_account'
90- # auth_uri: 'https://accounts.google.com/o/oauth2/auth'
91- # token_uri: 'https://oauth2.googleapis.com/token'
92- # auth_provider_x509_cert_url: 'https://www.googleapis.com/oauth2/v1/certs'
93- # project_id: ${{ secrets.fastlane_android_account_project_id }}
94- # private_key_id: ${{ secrets.fastlane_android_account_private_key_id }}
95- # private_key: '${{ secrets.fastlane_android_account_private_key }}'
96- # client_email: ${{ secrets.fastlane_android_account_client_email }}
97- # client_id: ${{ secrets.fastlane_android_account_client_id }}
98- # client_x509_cert_url: ${{ secrets.fastlane_android_account_client_x509_cert_url }}
99- # - name: Run fastlane
100- # env:
101- # FIREBASEAPPDISTRO_APP: ${{ secrets.fastlane_android_app_id }}
102- # GOOGLE_APPLICATION_CREDENTIALS: ${{ steps.service-account.outputs.full-path }}
103- # run: yarn deploy:android
104- #
105- # deploy-ios:
106- # name: '[iOS] Deploy'
107- # if: ${{ github.event.inputs.platform != 'Android' }}
108- # runs-on: macos-latest
109- # steps:
110- # - uses: actions/checkout@v3
111- # - uses: actions/setup-node@v1
112- # with:
113- # node-version: 16.x
114- # - uses: ruby/setup-ruby@v1
115- # env:
116- # BUNDLE_GEMFILE: ${{ github.workspace }}/sample/ios/Gemfile
117- # with:
118- # ruby-version: 2.7
119- # bundler-cache: true
120- # - name: Get lockfile hash
121- # id: lockfile_hash
122- # run: echo "::set-output name=hash::${{ hashFiles('**/yarn.lock') }}"
123- # - name: Check cached node_modules
124- # id: check_cache
125- # uses: actions/cache@v2
126- # with:
127- # path: ${{ env.CACHE_NODE_MODULES_PATH }}
128- # key: ${{ steps.lockfile_hash.outputs.hash }}
129- # - name: Install dependencies
130- # if: steps.check_cache.outputs.cache-hit == ''
131- # run:
132- # yarn install --frozen-lockfile
133- # - name: Install pods
134- # run: cd sample/ios && pod install
135- # - name: Create env.ts
136- # run:
137- # echo "export const APP_ID = '${{ secrets.sendbird_app_id }}';" >> sample/src/env.ts
138- # - name: Run fastlane
139- # env:
140- # TEAM_ID: ${{ secrets.fastlane_ios_team_id }}
141- # MATCH_PASSWORD: ${{ secrets.fastlane_ios_match_password }}
142- # MATCH_GIT_URL: ${{ secrets.fastlane_ios_match_git_url }}
143- # MATCH_GIT_BASIC_AUTHORIZATION: ${{ secrets.fastlane_ios_match_git_basic_authorization }}
144- # APPLE_ID: ${{ secrets.fastlane_ios_apple_id }}
145- # FASTLANE_APPLE_APPLICATION_SPECIFIC_PASSWORD: ${{ secrets.fastlane_ios_apple_application_specific_password }}
146- # run: yarn deploy:ios
161+ if [ -n "$APP_VERSION" ]; then
162+ yarn deploy:android version:$APP_VERSION
163+ else
164+ yarn deploy:android
165+ fi
0 commit comments