-
-
Notifications
You must be signed in to change notification settings - Fork 245
158 lines (131 loc) · 4.71 KB
/
build.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
name: Build
on:
pull_request:
push:
branches:
- develop
- master
jobs:
js:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [20.x]
npm-version: [10.x]
name: js node${{ matrix.node-version }}
steps:
- uses: actions/checkout@v2
- name: Set up node ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: Set up npm ${{ matrix.npm-version }}
run: npm i -g npm@"${{ matrix.npm-version }}"
- name: Cache node modules
uses: actions/cache@v1
env:
cache-name: cache-node-modules
with:
path: ~/.npm # npm cache files are stored in `~/.npm` on Linux/macOS
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Install dependencies
run: |
npm ci -f
- name: Install dependencies & build
run: |
npm run build-release --if-present
- name: Save context
uses: buildjet/cache/save@v3
with:
key: build-context-${{ github.run_id }}
path: ./
android:
needs: js
runs-on: ubuntu-latest
strategy:
matrix:
java-version: [ 17 ]
name: android java${{ matrix.java-version }}
steps:
- uses: actions/setup-java@v4
with:
distribution: 'oracle'
java-version: ${{ matrix.java-version }}
- name: Restore context
uses: buildjet/cache/restore@v3
with:
fail-on-cache-miss: true
key: build-context-${{ github.run_id }}
path: ./
- name: Build android
run: |
npx cap sync
cd android
chmod +x gradlew
./gradlew assemble
ios:
needs: js
runs-on: macos-latest
name: ios
steps:
- name: Restore context
uses: buildjet/cache/restore@v3
with:
fail-on-cache-miss: true
key: build-context-${{ github.run_id }}
path: ./
- name: setup-cocoapods
uses: maxim-lobanov/setup-cocoapods@v1
with:
podfile-path: ios/App/Podfile.lock
- uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: latest-stable
- name: Install certificate and provisioning profile
env:
BUILD_CERTIFICATE_BASE64: ${{ secrets.BUILD_CERTIFICATE_BASE64 }}
BUILD_PROVISION_PROFILE_BASE64: ${{ secrets.BUILD_PROVISION_PROFILE_BASE64 }}
BUILD_PROVISION_PROFILE_NEW_BOOKMARK_BASE64: ${{ secrets.BUILD_PROVISION_PROFILE_NEW_BOOKMARK_BASE64 }}
KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }}
run: |
# create variables
CERTIFICATE_PATH=$RUNNER_TEMP/build_certificate.p12
PP_PATH=$RUNNER_TEMP/build_pp.mobileprovision
PP2_PATH=$RUNNER_TEMP/build_pp2.mobileprovision
KEYCHAIN_PATH=$RUNNER_TEMP/app-signing.keychain-db
# import certificate and provisioning profile from secrets
echo -n "$BUILD_CERTIFICATE_BASE64" | base64 --decode -o $CERTIFICATE_PATH
echo -n "$BUILD_PROVISION_PROFILE_BASE64" | base64 --decode -o $PP_PATH
echo -n "$BUILD_PROVISION_PROFILE_NEW_BOOKMARK_BASE64" | base64 --decode -o $PP2_PATH
# create temporary keychain
security create-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
security set-keychain-settings -lut 21600 $KEYCHAIN_PATH
security unlock-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
# import certificate to keychain
security import $CERTIFICATE_PATH -P "" -A -t cert -f pkcs12 -k $KEYCHAIN_PATH
security list-keychain -d user -s $KEYCHAIN_PATH
# apply provisioning profile
mkdir -p ~/Library/MobileDevice/Provisioning\ Profiles
cp $PP_PATH ~/Library/MobileDevice/Provisioning\ Profiles
cp $PP2_PATH ~/Library/MobileDevice/Provisioning\ Profiles
- name: Capacitor sync
run: |
npx cap sync
- name: Build ios
env:
scheme: "Floccus"
run: |
cd ios/App
xcodebuild build-for-testing -scheme "$scheme" -workspace App.xcworkspace
summary:
runs-on: ubuntu-latest
needs: [ js, android, ios ]
if: always()
name: build-summary
steps:
- name: Summary status
run: if ${{ needs.js.result != 'success' || ( needs.android.result != 'success' && needs.selenium.result != 'skipped' ) || ( needs.ios.result != 'success' && needs.ios.result != 'skipped' ) }}; then exit 1; fi