forked from SchweizerischeBundesbahnen/DAS
-
Notifications
You must be signed in to change notification settings - Fork 0
143 lines (117 loc) · 4.68 KB
/
client_release_ios.yml
File metadata and controls
143 lines (117 loc) · 4.68 KB
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
# This workflow is triggered whenever a release please PR is merged with label autorelease:das_client.
# This builds and releases the iOS version of the app.
name: Client release iOS
on:
workflow_call:
workflow_dispatch:
permissions:
contents: write
packages: write
jobs:
prepare:
runs-on: macos-15
concurrency:
group: release-das-client-ios
defaults:
run:
working-directory: das_client
steps:
- uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: ~26.0
- uses: actions/checkout@v5
- uses: subosito/flutter-action@v2
with:
flutter-version: '3.35.x'
cache: true
- name: Setup melos
uses: bluefireteam/melos-action@v3
with:
melos-version: '^6.3.0'
run-bootstrap: 'false'
- name: Get dependencies
run: flutter pub get
- name: Generate sources
run: melos generate
- name: Upload generated srcs # saves around 40 sec
uses: actions/upload-artifact@v4
with:
name: gen_srcs_ios
path: |
**/*.g.dart
**/*.gr.dart
**/*.mocks.dart
**/i18n/gen
release:
needs: [prepare]
runs-on: macos-15
defaults:
run:
working-directory: das_client
strategy:
matrix:
include: # will run three jobs in parallel
- flavor: "dev"
bundle-id: 'ch.sbb.das.dev'
app-root: 'lib/main_dev.dart'
archive-filename: 'DAS Dev.xcarchive'
- flavor: "inte"
bundle-id: 'ch.sbb.das.inte'
app-root: 'lib/main_inte.dart'
archive-filename: 'DAS Inte.xcarchive'
- flavor: "prod"
bundle-id: 'ch.sbb.das'
app-root: 'lib/main_prod.dart'
archive-filename: 'DAS.xcarchive'
steps:
- uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: ~26.0
- uses: actions/checkout@v5
- uses: subosito/flutter-action@v2
with:
flutter-version: '3.35.x'
cache: true
- name: Get dependencies
run: flutter pub get
- name: Download gen srcs
uses: actions/download-artifact@v5
with:
name: gen_srcs_ios
- name: Install Apple signing certificate and appstore connect key
env:
SBB_APPSTORE_BASE64: ${{ secrets.SBB_APPSTORE_BASE64 }}
SBB_APPSTORE_P12_PASSWORD: ${{ secrets.SBB_APPSTORE_P12_PASSWORD }}
KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }}
APPSTORE_CONNECT_PRIVATE_KEY_BASE64: ${{ secrets.APPSTORE_CONNECT_PRIVATE_KEY_BASE64 }}
run: |
# create variables
SBB_CERTIFICATE_PATH=$RUNNER_TEMP/sbb_appstore.p12
KEYCHAIN_PATH=$RUNNER_TEMP/app-signing.keychain-db
APPSTORE_CONNECT_PRIVATE_KEY_PATH=~/AuthKey.p8
# import certificate and private key from secrets
echo -n "$SBB_APPSTORE_BASE64" | base64 --decode -o $SBB_CERTIFICATE_PATH
echo -n "$APPSTORE_CONNECT_PRIVATE_KEY_BASE64" | base64 --decode -o $APPSTORE_CONNECT_PRIVATE_KEY_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 $SBB_CERTIFICATE_PATH -P "$SBB_APPSTORE_P12_PASSWORD" -A -t cert -f pkcs12 -k $KEYCHAIN_PATH
security set-key-partition-list -S apple-tool:,apple: -k "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
security list-keychain -d user -s $KEYCHAIN_PATH
- name: Download Provisioning Profiles
uses: apple-actions/download-provisioning-profiles@v4
with:
bundle-id: ${{ matrix.bundle-id }}
issuer-id: ${{ secrets.APPSTORE_CONNECT_ISSUER_ID }}
api-key-id: ${{ secrets.APPSTORE_CONNECT_KEY_ID }}
api-private-key: ${{ secrets.APPSTORE_CONNECT_PRIVATE_KEY }}
- name: Build and Deploy iOS App
env:
APPSTORE_CONNECT_KEY_ID: ${{ secrets.APPSTORE_CONNECT_KEY_ID }}
APPSTORE_CONNECT_ISSUER_ID: ${{ secrets.APPSTORE_CONNECT_ISSUER_ID }}
run: |
flutter build ipa --flavor ${{ matrix.flavor }} -t ${{ matrix.app-root }} --release --no-codesign
xcodebuild -exportArchive -archivePath "build/ios/archive/${{ matrix.archive-filename }}" -exportOptionsPlist ios/exportOptionsRelease.plist -authenticationKeyIssuerID "$APPSTORE_CONNECT_ISSUER_ID" -authenticationKeyID "$APPSTORE_CONNECT_KEY_ID" -authenticationKeyPath ~/AuthKey.p8
working-directory: das_client/app