-
Notifications
You must be signed in to change notification settings - Fork 2
166 lines (139 loc) · 5.59 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
name: Build IOS
# Controls when the workflow will run
on:
# Triggers the workflow on push events but only for the "main" branch
# push:
# branches: [ "main" ]
# pull_request:
# branches: [ "main" ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
build:
runs-on: macOS-latest
env:
SHEME: 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:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v3
with:
path: 'cbreez'
- 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 --output $CERT_PATH
security import $CERT_PATH -k $KEYCHAIN_PATH -A
P12_KEY_PATH=$RUNNER_TEMP/key.p12
echo -n "$P12_BASE64" | base64 --decode --output $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-config
run: |
cd cbreez
echo "$GOOGLE_SERVICES_IOS" > ios/Runner/GoogleService-Info.plist
- uses: actions/checkout@v3
with:
repository: 'breez/breez-sdk'
ssh-key: ${{secrets.REPO_SSH_KEY}}
path: 'breez-sdk'
# Setup the flutter environment.
- uses: subosito/flutter-action@v2
with:
flutter-version: '3.7.12'
channel: 'stable'
- name: install dependencies
run: |
cargo install [email protected]
brew install protobuf
cd breez-sdk/libs/sdk-flutter
make init
cd ../sdk-core
make init
- name: build sdk
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
cd breez-sdk/libs/sdk-flutter
make ios-dev
- uses: actions/setup-java@v2
with:
distribution: 'zulu'
java-version: '17'
- name: flutter-doctor
run: |
cd cbreez
flutter doctor
- name: pub-get
run: |
cd cbreez
flutter pub get
- name: dart-analyze
run: |
cd cbreez
dart analyze --fatal-infos
- name: run-tests
run: |
cd cbreez
flutter test
- name: Install the provisioning profile
env:
PROVISIONING_PROFILE_BASE64: ${{ secrets.PROVISIONING_PROFILE_BASE64 }}
run: |
# create variables
PP_PATH=$RUNNER_TEMP/build_pp.mobileprovision
# import provisioning profile from secrets
echo -n "$PROVISIONING_PROFILE_BASE64" | base64 --decode --output $PP_PATH
# apply provisioning profile
mkdir -p ~/Library/MobileDevice/Provisioning\ Profiles
cp $PP_PATH ~/Library/MobileDevice/Provisioning\ Profiles
- name: override-config
env:
CONFIG_FILE: ${{secrets.CONFIG_FILE}}
run: |
echo "$CONFIG_FILE" > ./cbreez/config.json
- name: Build Flutter
run: |
cd cbreez
flutter build ios --release --no-codesign --dart-define-from-file=config.json
- name: Build resolve Swift dependencies
run: |
cd cbreez
xcodebuild -resolvePackageDependencies -workspace ios/Runner.xcworkspace -scheme ${{ env.SHEME }} -configuration ${{ env.BUILD_CONFIGURATION }}
- name: Build xArchive
run: |
cd cbreez
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.SHEME }} -configuration ${{ env.BUILD_CONFIGURATION }} -sdk 'iphoneos' -destination 'generic/platform=iOS' -archivePath build-output/app.xcarchive clean archive
- name: Export ipa
run: |
cd cbreez
xcodebuild -exportArchive -archivePath build-output/app.xcarchive -exportPath build-output/ios -exportOptionsPlist ios/ExportOptions.plist
- name: Publish iOS Artefacts
uses: actions/upload-artifact@v1
with:
name: release-ios
path: cbreez/build-output/ios
- 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