forked from wuba/taro-playground
-
Notifications
You must be signed in to change notification settings - Fork 0
132 lines (128 loc) · 4.87 KB
/
assemble_ios_release.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
# 工作流名称
name: Assemble Ios Release
# 触发工作流程的事件
on:
push:
tags: [ v* ]
pull_request:
branches: [ master ]
workflow_dispatch:
# 工作流环境变量
env:
# 应用的application_id
APP_ID: ${{secrets.APP_ID}}
APP_NAME: Taro
BUILD_TYPE: release
IOS_VERSION_NUMBER: 1.3.0
IOS_BUILD_NUMBER: 1.3.0.1
IOS_TEAM_ID: ${{secrets.TEAM_ID}}
IOS_PROVISIONING_PROFILE_SPECIFIER: ${{secrets.RELEASE_PROVISIONING_PROFILE_SPECIFIER}}
IOS_CODE_SIGN_IDENTITY: iPhone Distribution
IOS_SIGNING_CERTIFICATE_P12_DATA: ${{secrets.RELEASE_SIGNING_CERTIFICATE_P12_DATA}}
IOS_SIGNING_CERTIFICATE_PASSWORD: ${{secrets.RELEASE_SIGNING_CERTIFICATE_PASSWORD}}
IOS_PROVISIONING_PROFILE_DATA: ${{secrets.RELEASE_PROVISIONING_PROFILE_DATA}}
IOS_APP_STORE_CONNECT_USERNAME: ${{secrets.APP_STORE_CONNECT_USERNAME}}
IOS_APP_STORE_CONNECT_PASSWORD: ${{secrets.APP_STORE_CONNECT_PASSWORD}}
jobs:
assemble:
runs-on: macos-11
steps:
- name: Get current date
id: date
run: echo "::set-output name=timestamp::$(date +'%s')"
- name: Checkout Project
uses: actions/checkout@v2
- name: Cache node_modules Folder
uses: actions/cache@v2
with:
path: ${{ github.workspace }}/node_modules
key: ${{ runner.os }}-node_modules
restore-keys: ${{ runner.os }}-node_modules
- name: Get Yarn Cache Directory Path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: Cache Yarn
uses: actions/cache@v2
env:
cache-name: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/package.json') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Cache Pods
uses: actions/cache@v2
with:
path: ios/Pods
key: ${{ runner.os }}-pods-${{ hashFiles('**/Podfile.lock') }}
restore-keys: |
${{ runner.os }}-pods-
- name: Install Dependencies
run: |
yarn
- name: Build Taro React Native Bundle
run: |
yarn build:rn --platform ios
- name: Upload Taro React Native Bundle
uses: actions/upload-artifact@v2
with:
name: taro-ios-bundle
path: ${{ github.workspace }}/ios/main.jsbundle
- name: Install pods
run: cd ios && pod update --no-repo-update
- name: Change react-native-xcode.sh
run: |
cd node_modules/react-native/scripts
echo "exit 0;">react-native-xcode.sh
- name: Import signing certificate
env:
SIGNING_CERTIFICATE_P12_DATA: ${{ env.IOS_SIGNING_CERTIFICATE_P12_DATA }}
SIGNING_CERTIFICATE_PASSWORD: ${{ env.IOS_SIGNING_CERTIFICATE_PASSWORD }}
run: |
exec .github/scripts/import-certificate.sh
- name: Import provisioning profile
env:
PROVISIONING_PROFILE_DATA: ${{ env.IOS_PROVISIONING_PROFILE_DATA }}
run: |
exec .github/scripts/import-profile.sh
- name: Build app
env:
FL_APP_IDENTIFIER: ${{ env.APP_ID }}
FL_UPDATE_PLIST_DISPLAY_NAME: ${{ env.APP_NAME }}
FL_UPDATE_PLIST_PATH: taroDemo/Info.plist
FL_VERSION_NUMBER_VERSION_NUMBER: ${{ env.IOS_VERSION_NUMBER }}
FL_BUILD_NUMBER_BUILD_NUMBER: ${{ env.IOS_VERSION_NUMBER }}.${{steps.date.outputs.timestamp}}
FL_CODE_SIGN_IDENTITY: ${{ env.IOS_CODE_SIGN_IDENTITY }}
FL_PROVISIONING_PROFILE_SPECIFIER: ${{ env.IOS_PROVISIONING_PROFILE_SPECIFIER }}
FASTLANE_TEAM_ID: ${{ env.IOS_TEAM_ID }}
run: |
cd ios
bundle update
bundle exec fastlane build_release
- name: Upload Ios Products
uses: actions/upload-artifact@v2
with:
name: app-${{ env.BUILD_TYPE }}
path: |
${{ github.workspace }}/ios/taroDemo.ipa
${{ github.workspace }}/ios/taroDemo.app.dSYM.zip
- name: Upload app to App Store Connect
env:
APP_STORE_CONNECT_USERNAME: ${{ env.IOS_APP_STORE_CONNECT_USERNAME }}
APP_STORE_CONNECT_PASSWORD: ${{ env.IOS_APP_STORE_CONNECT_PASSWORD }}
run: |
cd ios
xcrun altool --upload-app -t ios -f "taroDemo.ipa" -u "$APP_STORE_CONNECT_USERNAME" -p "$APP_STORE_CONNECT_PASSWORD"
- name: Rename release assets
run: |
mv ios/taroDemo.ipa ios/app-${{ env.BUILD_TYPE }}.ipa
mv ios/taroDemo.app.dSYM.zip ios/app-${{ env.BUILD_TYPE }}.app.dSYM.zip
- name: Upload release assets
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: |
ios/app-${{ env.BUILD_TYPE }}.ipa
ios/app-${{ env.BUILD_TYPE }}.app.dSYM.zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}