Skip to content

Commit a10f372

Browse files
committed
ci: first go
1 parent 289734e commit a10f372

File tree

1 file changed

+70
-0
lines changed

1 file changed

+70
-0
lines changed

.github/workflows/build-ios.yml

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
name: "Build iOS app"
2+
3+
on:
4+
pull_request:
5+
push:
6+
7+
jobs:
8+
build_with_signing:
9+
runs-on: macos-latest
10+
steps:
11+
- name: check Xcode version
12+
run: /usr/bin/xcodebuild -version
13+
14+
- name: checkout repository
15+
uses: actions/checkout@v3
16+
17+
- name: Install the Apple certificate and provisioning profile
18+
env:
19+
BUILD_CERTIFICATE_BASE64: ${{ secrets.BUILD_CERTIFICATE_BASE64 }}
20+
P12_PASSWORD: ${{ secrets.P12_PASSWORD }}
21+
BUILD_PROVISION_PROFILE_BASE64: ${{ secrets.BUILD_PROVISION_PROFILE_BASE64 }}
22+
KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }}
23+
run: |
24+
# create variables
25+
CERTIFICATE_PATH=$RUNNER_TEMP/build_certificate.p12
26+
PP_PATH=$RUNNER_TEMP/build_pp.mobileprovision
27+
KEYCHAIN_PATH=$RUNNER_TEMP/app-signing.keychain-db
28+
29+
# import certificate and provisioning profile from secrets
30+
echo -n "$BUILD_CERTIFICATE_BASE64" | base64 --decode -o $CERTIFICATE_PATH
31+
echo -n "$BUILD_PROVISION_PROFILE_BASE64" | base64 --decode -o $PP_PATH
32+
33+
# create temporary keychain
34+
security create-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
35+
security set-keychain-settings -lut 21600 $KEYCHAIN_PATH
36+
security unlock-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
37+
38+
# import certificate to keychain
39+
security import $CERTIFICATE_PATH -P "$P12_PASSWORD" -A -t cert -f pkcs12 -k $KEYCHAIN_PATH
40+
security list-keychain -d user -s $KEYCHAIN_PATH
41+
42+
# apply provisioning profile
43+
mkdir -p ~/Library/MobileDevice/Provisioning\ Profiles
44+
cp $PP_PATH ~/Library/MobileDevice/Provisioning\ Profiles
45+
46+
- name: build archive
47+
run: |
48+
xcodebuild -scheme "Synctrain release" \
49+
-archivePath $RUNNER_TEMP/synctrain.xcarchive \
50+
-sdk iphoneos \
51+
-configuration Debug \
52+
-destination generic/platform=iOS \
53+
clean archive
54+
55+
- name: export ipa
56+
env:
57+
EXPORT_OPTIONS_PLIST: ${{ secrets.EXPORT_OPTIONS_PLIST }}
58+
run: |
59+
EXPORT_OPTS_PATH=$RUNNER_TEMP/ExportOptions.plist
60+
echo -n "$EXPORT_OPTIONS_PLIST" | base64 --decode -o $EXPORT_OPTS_PATH
61+
xcodebuild -exportArchive -archivePath $RUNNER_TEMP/synctrain.xcarchive -exportOptionsPlist $EXPORT_OPTS_PATH -exportPath $RUNNER_TEMP/build
62+
63+
- name: Upload application
64+
uses: actions/upload-artifact@v4
65+
with:
66+
name: app
67+
path: ${{ runner.temp }}/build/synctrain.ipa
68+
# you can also archive the entire directory
69+
# path: ${{ runner.temp }}/build
70+
retention-days: 3

0 commit comments

Comments
 (0)