-
Notifications
You must be signed in to change notification settings - Fork 0
280 lines (262 loc) · 12.1 KB
/
release-please.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
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
on:
push:
branches:
- main
permissions:
contents: write
pull-requests: write
packages: write
name: release-please
jobs:
release-please:
runs-on: ubuntu-latest
outputs:
das_client--release_created: ${{ steps.release.outputs.das_client--release_created }}
das_client--version: ${{ steps.release.outputs.das_client--version }}
das_client--tag_name: ${{ steps.release.outputs.das_client--tag_name }}
sfera-mock--release_created: ${{ steps.release.outputs.sfera-mock--release_created }}
sfera-mock--version: ${{ steps.release.outputs.sfera-mock--version }}
sfera-mock--tag_name: ${{ steps.release.outputs.sfera-mock--tag_name }}
backend--release_created: ${{ steps.release.outputs.backend--release_created }}
backend--version: ${{ steps.release.outputs.backend--version }}
backend--tag_name: ${{ steps.release.outputs.backend--tag_name }}
webapp--release_created: ${{ steps.release.outputs.webapp--release_created }}
webapp--version: ${{ steps.release.outputs.webapp--version }}
webapp--tag_name: ${{ steps.release.outputs.webapp--tag_name }}
steps:
- uses: google-github-actions/release-please-action@v4
id: release
das-client-ios-release:
needs: release-please
if: needs.release-please.outputs.das_client--release_created
runs-on: macos-latest
concurrency:
group: das-client-ios-release
defaults:
run:
working-directory: das_client
steps:
- name: Checkout code
uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'
- uses: subosito/flutter-action@v2
with:
flutter-version: '3.24.3'
- name: Install the 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 DEV'
uses: apple-actions/download-provisioning-profiles@v3
with:
bundle-id: 'ch.sbb.das.dev'
issuer-id: ${{ secrets.APPSTORE_CONNECT_ISSUER_ID }}
api-key-id: ${{ secrets.APPSTORE_CONNECT_KEY_ID }}
api-private-key: ${{ secrets.APPSTORE_CONNECT_PRIVATE_KEY }}
- name: 'Download Provisioning Profiles INTE'
uses: apple-actions/download-provisioning-profiles@v3
with:
bundle-id: 'ch.sbb.das.inte'
issuer-id: ${{ secrets.APPSTORE_CONNECT_ISSUER_ID }}
api-key-id: ${{ secrets.APPSTORE_CONNECT_KEY_ID }}
api-private-key: ${{ secrets.APPSTORE_CONNECT_PRIVATE_KEY }}
- name: 'Download Provisioning Profiles PROD'
uses: apple-actions/download-provisioning-profiles@v3
with:
bundle-id: 'ch.sbb.das'
issuer-id: ${{ secrets.APPSTORE_CONNECT_ISSUER_ID }}
api-key-id: ${{ secrets.APPSTORE_CONNECT_KEY_ID }}
api-private-key: ${{ secrets.APPSTORE_CONNECT_PRIVATE_KEY }}
- run: |
flutter pub get
flutter pub run build_runner build --delete-conflicting-outputs
- name: Build and Deploy iOS App DEV
env:
APPSTORE_CONNECT_KEY_ID: ${{ secrets.APPSTORE_CONNECT_KEY_ID }}
APPSTORE_CONNECT_ISSUER_ID: ${{ secrets.APPSTORE_CONNECT_ISSUER_ID }}
run: |
flutter build ipa --flavor dev -t lib/main_dev.dart --release --no-codesign
xcodebuild -exportArchive -archivePath "build/ios/archive/DAS Dev.xcarchive" -exportOptionsPlist ios/exportOptionsRelease.plist -authenticationKeyIssuerID "$APPSTORE_CONNECT_ISSUER_ID" -authenticationKeyID "$APPSTORE_CONNECT_KEY_ID" -authenticationKeyPath ~/AuthKey.p8
- name: Build and Deploy iOS App INTE
env:
APPSTORE_CONNECT_KEY_ID: ${{ secrets.APPSTORE_CONNECT_KEY_ID }}
APPSTORE_CONNECT_ISSUER_ID: ${{ secrets.APPSTORE_CONNECT_ISSUER_ID }}
run: |
flutter build ipa --flavor inte -t lib/main_inte.dart --release --no-codesign
xcodebuild -exportArchive -archivePath "build/ios/archive/DAS Inte.xcarchive" -exportOptionsPlist ios/exportOptionsRelease.plist -authenticationKeyIssuerID "$APPSTORE_CONNECT_ISSUER_ID" -authenticationKeyID "$APPSTORE_CONNECT_KEY_ID" -authenticationKeyPath ~/AuthKey.p8
- name: Build and Deploy iOS App PROD
env:
APPSTORE_CONNECT_KEY_ID: ${{ secrets.APPSTORE_CONNECT_KEY_ID }}
APPSTORE_CONNECT_ISSUER_ID: ${{ secrets.APPSTORE_CONNECT_ISSUER_ID }}
run: |
flutter build ipa --flavor prod -t lib/main_prod.dart --release --no-codesign
xcodebuild -exportArchive -archivePath "build/ios/archive/DAS.xcarchive" -exportOptionsPlist ios/exportOptionsRelease.plist -authenticationKeyIssuerID "$APPSTORE_CONNECT_ISSUER_ID" -authenticationKeyID "$APPSTORE_CONNECT_KEY_ID" -authenticationKeyPath ~/AuthKey.p8
das-client-android-release:
needs: release-please
if: needs.release-please.outputs.das_client--release_created
runs-on: macos-latest
concurrency:
group: das-client-android-release
defaults:
run:
working-directory: das_client
steps:
- name: Checkout code
uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'
- uses: subosito/flutter-action@v2
with:
flutter-version: '3.24.3'
- name: Prepare Flutter Android Build
env:
ANDROID_KEYSTORE_STRING: ${{ secrets.ANDROID_KEYSTORE }}
ANDROID_KEYSTORE: ${{ github.workspace }}/das_client/android/das.keystore
ANDROID_KEYSTORE_PASSWORD: ${{ secrets.ANDROID_KEYSTORE_PASSWORD }}
ANDROID_KEY_ALIAS: ${{ secrets.ANDROID_KEY_ALIAS }}
ANDROID_KEY_PASSWORD: ${{ secrets.ANDROID_KEY_PASSWORD }}
run: |
echo $ANDROID_KEYSTORE_STRING | base64 -d > $ANDROID_KEYSTORE
echo "ANDROID_KEYSTORE=$ANDROID_KEYSTORE" >> "$GITHUB_ENV"
echo "ANDROID_KEYSTORE_PASSWORD=$ANDROID_KEYSTORE_PASSWORD" >> "$GITHUB_ENV"
echo "ANDROID_KEY_ALIAS=$ANDROID_KEY_ALIAS" >> "$GITHUB_ENV"
echo "ANDROID_KEY_PASSWORD=$ANDROID_KEY_PASSWORD" >> "$GITHUB_ENV"
flutter pub get
flutter pub run build_runner build --delete-conflicting-outputs
- run: flutter test
- run: flutter build appbundle --flavor dev -t lib/main_dev.dart
- run: flutter build appbundle --flavor inte -t lib/main_inte.dart
- run: flutter build appbundle --flavor prod -t lib/main_prod.dart
- name: Upload DEV App
uses: r0adkll/upload-google-play@v1.1.3
with:
serviceAccountJsonPlainText: ${{ secrets.ANDROID_SERVICE_ACCOUNT_JSON }}
packageName: ch.sbb.das.client.dev
releaseFiles: das_client/build/app/outputs/bundle/devRelease/app-dev-release.aab
track: internal
status: draft
- name: Upload INTE App
uses: r0adkll/upload-google-play@v1.1.3
with:
serviceAccountJsonPlainText: ${{ secrets.ANDROID_SERVICE_ACCOUNT_JSON }}
packageName: ch.sbb.das.client.inte
releaseFiles: das_client/build/app/outputs/bundle/inteRelease/app-inte-release.aab
track: internal
status: draft
- name: Upload PROD App
uses: r0adkll/upload-google-play@v1.1.3
with:
serviceAccountJsonPlainText: ${{ secrets.ANDROID_SERVICE_ACCOUNT_JSON }}
packageName: ch.sbb.das.client
releaseFiles: das_client/build/app/outputs/bundle/prodRelease/app-prod-release.aab
track: internal
status: draft
sfera-mock-release:
needs: release-please
if: needs.release-please.outputs.sfera-mock--release_created
runs-on: ubuntu-latest
defaults:
run:
working-directory: sfera-mock
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
cache: 'maven'
- name: Login to GitHub Container Registry
run: echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io --username ${{ github.actor }} --password-stdin
- name: Create container image
env:
IMAGE_ID: ghcr.io/${{ github.repository }}/sfera-mock
VERSION: ${{ needs.release-please.outputs.sfera-mock--version }}
run: |
# Convert to lowercase
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]')
mvn spring-boot:build-image \
-Dmaven.test.skip=true \
-Dspring-boot.build-image.imageName=$IMAGE_ID:$VERSION
docker push $IMAGE_ID:$VERSION
docker tag $IMAGE_ID:$VERSION $IMAGE_ID:latest
docker push $IMAGE_ID:latest
backend-release:
needs: release-please
if: needs.release-please.outputs.backend--release_created
runs-on: ubuntu-latest
defaults:
run:
working-directory: backend
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
cache: 'maven'
- name: Login to GitHub Container Registry
run: echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io --username ${{ github.actor }} --password-stdin
- name: Create container image
env:
IMAGE_ID: ghcr.io/${{ github.repository }}/backend
VERSION: ${{ needs.release-please.outputs.backend--version }}
run: |
# Convert to lowercase
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]')
mvn spring-boot:build-image \
-Dmaven.test.skip=true \
-Dspring-boot.build-image.imageName=$IMAGE_ID:$VERSION
docker push $IMAGE_ID:$VERSION
docker tag $IMAGE_ID:$VERSION $IMAGE_ID:latest
docker push $IMAGE_ID:latest
webapp-release:
needs: release-please
if: needs.release-please.outputs.webapp--release_created
runs-on: ubuntu-latest
defaults:
run:
working-directory: webapp
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version-file: 'webapp/.nvmrc'
cache: 'npm'
cache-dependency-path: 'webapp/package-lock.json'
- name: Login to GitHub Container Registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u $ --password-stdin
- name: Create container image
env:
IMAGE_REPO: ghcr.io/${{ github.repository }}/webapp
IMAGE_TAG: ${{ needs.release-please.outputs.webapp--version }}
DOCKER_BUILDKIT: 1
run: |
# Convert to lowercase
IMAGE_REPO=$(echo $IMAGE_REPO | tr '[A-Z]' '[a-z]')
docker build -t $IMAGE_REPO:$IMAGE_TAG .
docker push $IMAGE_REPO:$IMAGE_TAG
docker tag $IMAGE_REPO:$IMAGE_TAG $IMAGE_REPO:latest
docker push $IMAGE_REPO:latest