-
Notifications
You must be signed in to change notification settings - Fork 0
114 lines (104 loc) · 5.3 KB
/
flutter_ios_build.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
# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-maven
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
name: Flutter iOS Build
defaults:
run:
working-directory: das_client
on:
push:
paths:
- 'das_client/**'
branches: [ "feature/ios-signing" ]
jobs:
build:
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'
- uses: subosito/flutter-action@v2
with:
flutter-version: '3.22.2'
- 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@v1
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@v1
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@v1
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
- run: flutter test
- 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
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
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
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
- name: Archive Apps
uses: actions/upload-artifact@v4
with:
name: Build
path: |
das_client/build/ios/archive/**
das_client/build/ios/ipa/**
das_client/build/ios/iphoneos/**
retention-days: 1