-
Notifications
You must be signed in to change notification settings - Fork 0
203 lines (177 loc) · 5.83 KB
/
mob-react-native-production-deploy-ios.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
name: Firebase deployment
# Variables needed setted in testing environment
# AWS_BUCKET
# ENV_VARIABLES
# ENV_FILE_NAME
# IOS_PACKAGE_NAME
# IOS_SCHEMA
on:
workflow_call:
inputs:
RELEASE_TAG:
type: string
description: Tag
required: true
PROJECT_PATH:
type: string
description: 'xcode project file path. Example: ios/project.xcodeproj'
required: true
WORKSPACE_PATH:
type: string
description: 'xcode workspace file path. Example: ios/project.xcworkspace'
required: true
NODE_VERSION:
type: string
default: '18'
required: false
DISABLE_CACHE:
type: string
default: 'false'
required: false
SLACK_CHANNEL:
type: string
required: false
RUBY_VERSION:
type: string
default: ruby
required: false
secrets:
SLACK_WEBHOOK_URL:
required: true
# IOS
IOS_P12_BASE64:
required: true
IOS_MOBILE_PROVISION_BASE64:
required: true
IOS_TEAM_ID:
required: true
IOS_CERTIFICATE_PASSWORD:
required: true
IOS_APPSTORE_ISSUER_ID:
required: true
IOS_APPSTORE_API_KEY_ID:
required: true
IOS_APPSTORE_API_PRIVATE_KEY:
required: true
AWS_ACCESS_KEY_ID:
required: true
AWS_SECRET_ACCESS_KEY:
required: true
AWS_REGION:
required: true
env:
RELEASE_TAG: '${{ inputs.RELEASE_TAG }}'
DISABLE_CACHE: '${{ inputs.DISABLE_CACHE }}'
SLACK_CHANNEL: '${{ inputs.SLACK_CHANNEL }}'
NODE_VERSION: '${{ inputs.NODE_VERSION }}'
RUBY_VERSION: '${{ inputs.RUBY_VERSION }}'
SLACK_WEBHOOK_URL: '${{ secrets.SLACK_WEBHOOK_URL }}'
GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
# IOS
IOS_P12_BASE64: '${{ secrets.IOS_P12_BASE64 }}'
IOS_MOBILE_PROVISION_BASE64: '${{ secrets.IOS_MOBILE_PROVISION_BASE64 }}'
IOS_TEAM_ID: '${{ secrets.IOS_TEAM_ID }}'
IOS_CERTIFICATE_PASSWORD: '${{ secrets.IOS_CERTIFICATE_PASSWORD }}'
IOS_APPSTORE_ISSUER_ID: '${{ secrets.IOS_APPSTORE_ISSUER_ID }}'
IOS_APPSTORE_API_KEY_ID: '${{ secrets.IOS_APPSTORE_API_KEY_ID }}'
IOS_APPSTORE_API_PRIVATE_KEY: '${{ secrets.IOS_APPSTORE_API_PRIVATE_KEY }}'
IOS_OUTPUT_FILEPATH: output.ipa
jobs:
deploy:
environment: production
runs-on: macos-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}
- name: Cache dependencies
uses: actions/cache@v3
if: env.DISABLE_CACHE != 'true'
id: cache
with:
path: ./node_modules
key: modules-${{ hashFiles('package-lock.json') }}
- name: Install dependencies
if: (steps.cache.outputs.cache-hit != 'true')
run: npm ci --ignore-scripts
- name: Bump version
uses: yanamura/[email protected]
with:
project-path: ios
version: ${{ env.RELEASE_TAG }}
build-number: 1
- name: Modify package.json based on bumped tag
shell: bash
run: |
echo sed -i 's/\"version\":\s*\"[0-9]+\.[0-9]+\.[0-9]+\",\"version\": \"${{ env.RELEASE_TAG }}\"/g' package.json
- name: Create .env file
shell: bash
run: echo "${{ vars.ENV_VARIABLES }}" > ${{ vars.ENV_FILE_NAME }}
- name: Get project name
uses: antifree/[email protected]
with:
filename: app.json
prefix: app
- name: Setup Ruby (bundle)
uses: ruby/[email protected]
with:
ruby-version: ${{ env.RUBY_VERSION }}
bundler-cache: true
- name: Restore Pods cache
uses: actions/cache@v3
with:
path: |
ios/Pods
~/Library/Caches/CocoaPods
~/.cocoapods
key: ${{ runner.os }}-pods-${{ hashFiles('ios/Podfile.lock') }}
restore-keys: |
${{ runner.os }}-pods-
- name: Install Pods
run: cd ios && pod install --repo-update
- name: Build React
run: npm run build:ios
- name: Build IOS App
uses: yukiarrr/[email protected]
with:
p12-base64: ${{ env.IOS_P12_BASE64 }}
mobileprovision-base64: ${{ env.IOS_MOBILE_PROVISION_BASE64 }}
team-id: ${{ env.IOS_TEAM_ID }}
certificate-password: ${{ env.IOS_CERTIFICATE_PASSWORD }}
code-signing-identity: iPhone Distribution
project-path: ${{ inputs.PROJECT_PATH }}
workspace-path: ${{ inputs.WORKSPACE_PATH }}
scheme: ${{ vars.IOS_SCHEMA }}
export-method: app-store
- name: Configure AWS Credentials
uses: aws-actions/[email protected]
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ secrets.AWS_REGION }}
- name: Upload artifact S3
shell: bash
env:
FILE_NAME: '${{ vars.IOS_PACKAGE_NAME }}-${{ env.RELEASE_TAG }}.ipa'
run: aws s3 cp ${{ env.IOS_OUTPUT_FILEPATH }} s3://${{ vars.AWS_BUCKET }}/${{ env.app_name }}/ios/${{ env.FILE_NAME }}
- name: Upload app to TestFlight
uses: apple-actions/upload-testflight-build@v1
with:
app-path: ${{ env.IOS_OUTPUT_FILEPATH }}
issuer-id: ${{ secrets.IOS_APPSTORE_ISSUER_ID }}
api-key-id: ${{ secrets.IOS_APPSTORE_API_KEY_ID }}
api-private-key: ${{ secrets.IOS_APPSTORE_API_PRIVATE_KEY }}
notify:
runs-on: ubuntu-latest
needs:
- deploy
if: success() || failure()
continue-on-error: true
steps:
- name: Slack Notify
uses: steplix/[email protected]
with:
template: push
status: failure
channel: ${{ env.SLACK_CHANNEL }}