Skip to content

Commit 9b7f7ab

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

File tree

1 file changed

+84
-0
lines changed

1 file changed

+84
-0
lines changed

.github/workflows/build-ios.yml

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

0 commit comments

Comments
 (0)