-
Notifications
You must be signed in to change notification settings - Fork 2
194 lines (167 loc) Β· 7.2 KB
/
build-ios.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
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
name: Build iOS
on:
workflow_dispatch:
inputs:
ref:
description: 'SDK commit/tag/branch reference'
required: false
type: string
default: 'main'
jobs:
build-ios:
name: Build iOS
runs-on: macOS-13
env:
SCHEME: Runner
BUILD_CONFIGURATION: Release
TESTFLIGHT_USERNAME: ${{secrets.TESTFLIGHT_USERNAME}}
TESTFLIGHT_PASSWORD: ${{secrets.TESTFLIGHT_PASSWORD}}
IOS_VERSION_STRING: 0.1.0
DISTRIBUTION_CERT: ${{secrets.DISTRIBUTION_CERT}}
P12_BASE64: ${{secrets.P12_BASE64}}
P12_PASSWORD: ${{secrets.P12_PASSWORD}}
GOOGLE_SERVICES_IOS: ${{secrets.GOOGLE_SERVICES_IOS}}
steps:
- name: ποΈ Setup c-breez repository
uses: actions/checkout@v4
with:
path: 'cbreez'
- name: Install rust
run: |
rustup set auto-self-update disable
rustup toolchain install stable --profile minimal
- name: ποΈ Setup Java
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: '17'
- name: ποΈ Setup Flutter
uses: subosito/flutter-action@v2
with:
channel: 'stable'
flutter-version: 3.22.3 # Pinned until resource linking issues on Android is resolved with 3.24
cache: true
- name: π Install Keychain keys
run: |
KEYCHAIN_PATH=$RUNNER_TEMP/ios-build.keychain
security create-keychain -p ci $KEYCHAIN_PATH
security default-keychain -s $KEYCHAIN_PATH
security unlock-keychain -p ci $KEYCHAIN_PATH
security set-keychain-settings -t 6400 -l $KEYCHAIN_PATH
CERT_PATH=$RUNNER_TEMP/apple_distribution.cer
echo -n "$DISTRIBUTION_CERT" | base64 --decode -o $CERT_PATH
security import $CERT_PATH -k $KEYCHAIN_PATH -A
P12_KEY_PATH=$RUNNER_TEMP/key.p12
echo -n "$P12_BASE64" | base64 --decode -o $P12_KEY_PATH
security import $P12_KEY_PATH -k $KEYCHAIN_PATH -P "$P12_PASSWORD" -A
security set-key-partition-list -S apple-tool:,apple: -s -k ci $KEYCHAIN_PATH > /dev/null
- name: ποΈ Copy Firebase configuration file
working-directory: cbreez
run: echo "$GOOGLE_SERVICES_IOS" > ios/Runner/GoogleService-Info.plist
- name: ποΈ Setup breez-sdk repository
uses: actions/checkout@v4
with:
repository: 'breez/breez-sdk'
ssh-key: ${{secrets.REPO_SSH_KEY}}
path: 'breez-sdk'
ref: ${{ inputs.ref }}
- name: ποΈ Rust cache
uses: Swatinem/rust-cache@v2
with:
workspaces: breez-sdk/libs
cache-all-crates: true
- name: π¦ Install Breez SDK dependencies
run: |
cargo install cargo-ndk
brew install protobuf
cd breez-sdk/libs/sdk-flutter
make init
cd ../sdk-core
make init
- name: π Install SSH Key
env:
SSH_PRIVATE_KEY: ${{secrets.REPO_SSH_KEY}}
run: |
mkdir -p ~/.ssh
echo "$SSH_PRIVATE_KEY" > ~/.ssh/id_rsa
sudo chmod 600 ~/.ssh/id_rsa
ssh-add ~/.ssh/id_rsa
- name: π¨ Build Breez SDK
working-directory: breez-sdk/libs/sdk-flutter
run: |
rm -rf ../target
cargo check
make ios
- name: ποΈ Populate Flutter tool's cache of binary artifacts.
working-directory: cbreez
run: flutter precache
- name: π¦ Install Flutter dependencies
working-directory: cbreez
run: flutter pub get
- name: π Perform static analysis
working-directory: cbreez
run: dart analyze --fatal-infos
- name: π οΈ Run tests
working-directory: cbreez
run: flutter test
- name: βοΈ Setup compile-time variables
env:
CONFIG_FILE: ${{secrets.CONFIG_FILE}}
run: echo "$CONFIG_FILE" > ./cbreez/config.json
- name: π Install the Provisioning Profile
env:
PROVISIONING_PROFILE_BASE64: ${{ secrets.PROVISIONING_PROFILE_BASE64 }}
NOTIFICATION_PROVISIONING_PROFILE_BASE64: ${{ secrets.NOTIFICATION_PROVISIONING_PROFILE_BASE64 }}
run: |
# create variables
PP_PATH=$RUNNER_TEMP/build_pp.mobileprovision
NOTIFICATIONS_PP_PATH=$RUNNER_TEMP/build_notifications_pp.mobileprovision
# import provisioning profile from secrets
echo -n "$PROVISIONING_PROFILE_BASE64" | base64 --decode -o $PP_PATH
echo -n "$NOTIFICATION_PROVISIONING_PROFILE_BASE64" | base64 --decode -o $NOTIFICATIONS_PP_PATH
# apply provisioning profile
mkdir -p ~/Library/MobileDevice/Provisioning\ Profiles
cp $PP_PATH ~/Library/MobileDevice/Provisioning\ Profiles
cp $NOTIFICATIONS_PP_PATH ~/Library/MobileDevice/Provisioning\ Profiles
- name: π Build app
working-directory: cbreez
run: flutter build ios --release --split-debug-info=./obsfucated/debug --obfuscate --config-only --no-pub --no-codesign --dart-define-from-file=config.json
- name: π¦ Resolve Swift package dependencies
working-directory: cbreez
run: xcodebuild -resolvePackageDependencies -workspace ios/Runner.xcworkspace -scheme ${{ env.SCHEME }} -configuration ${{ env.BUILD_CONFIGURATION }}
- name: π¨ Build application and generate xcarchive file
working-directory: cbreez
run: |
buildNumber=$(($GITHUB_RUN_NUMBER + 6000)).1
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $buildNumber" ios/Runner/Info.plist
/usr/libexec/PlistBuddy -c "Set :CFBundleShortVersionString ${{ env.IOS_VERSION_STRING }}" ios/Runner/Info.plist
xcodebuild -workspace ios/Runner.xcworkspace -scheme ${{ env.SCHEME }} -configuration ${{ env.BUILD_CONFIGURATION }} -sdk 'iphoneos' -destination 'generic/platform=iOS' -archivePath build-output/app.xcarchive clean archive
- name: π€ Export the archive to an ipa file
working-directory: cbreez
run: xcodebuild -exportArchive -archivePath build-output/app.xcarchive -exportPath build-output/ios -exportOptionsPlist ios/ExportOptions.plist
- name: ποΈ Compress build folder
if: github.event_name == 'release'
uses: TheDoctor0/zip-release@master
with:
filename: build.zip
directory: cbreez/build/ios/iphoneos
type: zip
- name: π€ Upload release
if: github.event_name == 'release'
uses: svenstaro/upload-release-action@v2
with:
asset_name: release-iOS.zip
file: cbreez/build/ios/iphoneos/build.zip
overwrite: true
repo_token: ${{ secrets.GITHUB_TOKEN }}
- name: π€ Upload artifact
if: github.event_name != 'release'
uses: actions/upload-artifact@v3
with:
name: release-iOS
path: cbreez/build/ios/iphoneos
- name: π± Publish to TestFlight
run: |
altool="$(dirname "$(xcode-select -p)")/Developer/usr/bin/altool"
ipa="$PWD/cbreez/build-output/ios/c_breez.ipa"
"$altool" --upload-app --type ios --file "$ipa" --username $TESTFLIGHT_USERNAME --password $TESTFLIGHT_PASSWORD