-
Notifications
You must be signed in to change notification settings - Fork 12
178 lines (176 loc) · 6.71 KB
/
ci.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
name: Build Android and iOS
on: push
jobs:
install-and-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 18
- name: Setup caching
uses: actions/cache@v4
with:
path: |
node_modules
*/*/node_modules
key: cache-${{ runner.OS }}-${{ hashFiles('**/*.lock') }}
restore-keys: |
cache-${{ runner.OS }}-
- name: Install dependencies
run: |
yarn
- name: Run tests
run: |
yarn workspace @thu-info/app lint
yarn workspace @thu-info/app test
build-android:
needs: install-and-test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: "corretto"
java-version: "17"
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 18
- name: Setup caching
if: startsWith(github.ref, 'refs/tags') == false
uses: actions/cache@v4
with:
path: |
node_modules
*/*/node_modules
key: cache-${{ runner.OS }}-${{ hashFiles('**/*.lock') }}
restore-keys: |
cache-${{ runner.OS }}-
- name: Install dependencies
run: |
yarn
- name: Prepare for building
env:
SECRET_PASSWORD: ${{ secrets.SECRET_PASSWORD }}
run: |
openssl aes-256-cbc -k "$SECRET_PASSWORD" -in apps/thu-info-app/android/app/THUInfo.jks.enc -out apps/thu-info-app/android/app/THUInfo.jks -d
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
with:
build-root-directory: apps/thu-info-app/android
- name: Build android release
env:
ANDROID_KEY_ALIAS: ${{ secrets.ANDROID_KEY_ALIAS }}
ANDROID_KEY_PASSWORD: ${{ secrets.ANDROID_KEY_PASSWORD }}
ANDROID_STORE_PASSWORD: ${{ secrets.ANDROID_STORE_PASSWORD }}
SIGNATURE_DIGEST: ${{ secrets.SIGNATURE_DIGEST }}
run: |
cd apps/thu-info-app/android && ./gradlew assembleRelease && cd ../../..
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: app-release.apk
path: apps/thu-info-app/android/app/build/outputs/apk/release/app-release.apk
- name: Prepare for release
id: prepare_release
if: startsWith(github.ref, 'refs/tags')
run: |
export ref='${{ github.ref }}'
export tag=${ref:10}
echo "::set-output name=tag::$tag"
mv apps/thu-info-app/android/app/build/outputs/apk/release/app-release.apk THUInfo_release_${tag}.apk
- name: Prepare for building (allow rooted)
run: |
sed -i "/preventRoot/d" apps/thu-info-app/android/app/src/main/java/com/unidy2002/thuinfo/MainApplication.kt
- name: Build android release (allow rooted)
env:
ANDROID_KEY_ALIAS: ${{ secrets.ANDROID_KEY_ALIAS }}
ANDROID_KEY_PASSWORD: ${{ secrets.ANDROID_KEY_PASSWORD }}
ANDROID_STORE_PASSWORD: ${{ secrets.ANDROID_STORE_PASSWORD }}
SIGNATURE_DIGEST: ${{ secrets.SIGNATURE_DIGEST }}
run: |
cd apps/thu-info-app/android && ./gradlew assembleRelease && cd ../../..
- name: Upload artifact (allow rooted)
uses: actions/upload-artifact@v4
with:
name: app-release-allow-rooted.apk
path: apps/thu-info-app/android/app/build/outputs/apk/release/app-release.apk
- name: Prepare for release (allow rooted)
if: startsWith(github.ref, 'refs/tags')
run: |
export ref='${{ github.ref }}'
export tag=${ref:10}
mv apps/thu-info-app/android/app/build/outputs/apk/release/app-release.apk THUInfo_release_${tag}_allow_rooted.apk
- name: Create Release
if: startsWith(github.ref, 'refs/tags')
uses: softprops/action-gh-release@v2
with:
body_path: ./release-notes.md
files: |
THUInfo_release_${{ steps.prepare_release.outputs.tag }}.apk
THUInfo_release_${{ steps.prepare_release.outputs.tag }}_allow_rooted.apk
build-ios:
needs: install-and-test
runs-on: macos-14
steps:
- uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 18
- name: Setup caching
if: startsWith(github.ref, 'refs/tags') == false
uses: actions/cache@v4
with:
path: |
node_modules
*/*/node_modules
apps/thu-info-app/ios/Pods
vendor/bundle
key: cache-${{ runner.OS }}-${{ hashFiles('**/*.lock') }}
restore-keys: |
cache-${{ runner.OS }}-
- name: Setup ccache
if: startsWith(github.ref, 'refs/tags') == false
uses: hendrikmuhs/ccache-action@main
- name: Install dependencies
run: |
yarn
bundle install
cd apps/thu-info-app/ios && bundle exec pod update hermes-engine boost RCT-Folly SocketRocket && bundle exec pod install && cd ../../..
- name: Commit lockfile changes
if: endsWith(github.ref, 'master') == true
continue-on-error: true
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git add Gemfile.lock apps/thu-info-app/ios/Podfile.lock
git commit -m "chore: lockfile maintenance"
- name: Push lockfile changes
if: endsWith(github.ref, 'master') == true
uses: ad-m/github-push-action@master
with:
branch: ${{ github.ref }}
continue-on-error: true
- name: SSH setting up
run: |
echo "${{ secrets.CERTIFICATE_REPO_PRIVATE_KEY }}" | tr -d "\r" | ssh-add - > /dev/null
- name: Update beta
run: cd apps/thu-info-app/ios && fastlane beta
env:
MATCH_PASSWORD: ${{ secrets.MATCH_GIT_BASIC_AUTHORIZATION }}
APPSTORE_API_PRIVATE_KEY: ${{ secrets.APPSTORE_API_PRIVATE_KEY }}
APPSTORE_API_PRIVATE_KEY_ID: ${{ secrets.APPSTORE_API_PRIVATE_KEY_ID }}
APPSTORE_ISSUER_ID: ${{ secrets.APPSTORE_ISSUER_ID }}
CCACHE_SLOPPINESS: "clang_index_store,file_stat_matches,include_file_ctime,include_file_mtime,ivfsoverlay,pch_defines,modules,system_headers,time_macros"
CCACHE_FILECLONE: "true"
CCACHE_DEPEND: "true"
CCACHE_INODECACHE: "true"
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: thu_info.ipa
path: apps/thu-info-app/ios/thu_info.ipa