-
Notifications
You must be signed in to change notification settings - Fork 1
185 lines (160 loc) · 5.57 KB
/
shared-workflow.yaml
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
name: Shared Build Workflow
on:
workflow_call:
inputs:
package-name:
description: 'The name of the package to build (e.g. conferenceapp)'
required: true
type: string
android-build:
description: 'Whether to build Android APK'
required: false
default: false
type: boolean
ios-build:
description: 'Whether to build iOS IPA'
required: false
default: false
type: boolean
build-version:
description: 'Version number for the release'
required: false
default: '1.0.0'
type: string
build-number:
description: 'Build number for the release'
required: false
default: '1'
type: string
secrets:
SERVICE_ACCOUNT_JSON:
required: false
APP_STORE_CONNECT_ISSUER_ID:
required: false
APP_STORE_CONNECT_KEY_IDENTIFIER:
required: false
APP_STORE_CONNECT_PRIVATE_KEY:
required: false
CERTIFICATE_PRIVATE_KEY:
required: false
APP_STORE_APP_ID:
required: false
SHOREBIRD_TOKEN:
required: false
KEYSTORE_BASE64:
required: false
KEYSTORE_PASSWORD:
required: false
KEY_ALIAS:
required: false
KEY_PASSWORD:
required: false
ENV_BASE64:
required: false
FIREBASE_APP_ID:
required: false
FIREBASE_CREDENTIAL_FILE_CONTENT:
required: false
env:
SHOREBIRD_TOKEN: ${{ secrets.SHOREBIRD_TOKEN }}
APP_STORE_CONNECT_ISSUER_ID: ${{ secrets.APP_STORE_CONNECT_ISSUER_ID }}
APP_STORE_CONNECT_KEY_IDENTIFIER: ${{ secrets.APP_STORE_CONNECT_KEY_IDENTIFIER }}
APP_STORE_CONNECT_PRIVATE_KEY: ${{ secrets.APP_STORE_CONNECT_PRIVATE_KEY }}
CERTIFICATE_PRIVATE_KEY: ${{ secrets.CERTIFICATE_PRIVATE_KEY }}
APP_STORE_APP_ID: ${{ secrets.APP_STORE_APP_ID }}
FIREBASE_APP_ID: ${{ secrets.FIREBASE_APP_ID }}
FIREBASE_CREDENTIAL_FILE_CONTENT: ${{ secrets.FIREBASE_CREDENTIAL_FILE_CONTENT }}
jobs:
check-formatting:
if: ${{ github.event_name == 'pull_request' }}
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: '3.24.3'
cache: true
- name: Enable melos
run: dart pub global activate melos
- name: Get packages
run: melos bootstrap
- name: Generate Files
run: melos generate
- name: Check formatting
run: dart format --set-exit-if-changed .
working-directory: packages/${{ inputs['package-name'] }}
- name: Run Linter
run: flutter analyze
working-directory: packages/${{ inputs['package-name'] }}
ios-build:
if: inputs.ios-build == true
runs-on: macos-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
ref: ${{ github.event.sha }}
fetch-depth: 0
- name: 🐦 Setup Shorebird
uses: shorebirdtech/setup-shorebird@v1
with:
cache: true
- name: Cache CocoaPods dependencies
uses: actions/cache@v4
with:
path: |
~/.cocoapods
ios/Pods
key: ${{ runner.os }}-pods-${{ hashFiles('**/Podfile.lock') }}
restore-keys: |
${{ runner.os }}-pods-
- name: Set up Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: '3.24.3'
cache: true
- name: Enable melos
run: dart pub global activate melos
- name: Get packages
run: melos bootstrap
- name: Generate Files
run: melos generate
- name: Install dependencies
run: flutter pub get
working-directory: packages/${{ inputs['package-name'] }}
- name: Prepare .env file
run: |
echo "${{ secrets.ENV_BASE64 }}" | base64 -d > ${{ github.workspace }}/packages/${{ inputs['package-name'] }}/.env
- name: Install Codemagic CLI tools
run: pip install codemagic-cli-tools
working-directory: packages/${{ inputs['package-name'] }}
- name: Set up keychain
run: keychain initialize
working-directory: packages/${{ inputs['package-name'] }}
- name: Fetch signing files from App Store Connect
run: |
app-store-connect fetch-signing-files $(xcode-project detect-bundle-id) \
--type IOS_APP_STORE \
--create
working-directory: packages/${{ inputs['package-name'] }}
- name: Set up signing certificate in keychain
run: keychain add-certificates
working-directory: packages/${{ inputs['package-name'] }}
- name: Set up code signing in Xcode project
run: xcode-project use-profiles
working-directory: packages/${{ inputs['package-name'] }}
- name: 🚀 Shorebird Release
id: shorebird-release
uses: shorebirdtech/shorebird-release@v0
with:
working-directory: packages/${{ inputs['package-name'] }}
platform: ios
args: --flutter-version=3.24.3 -- --dart-define-from-file=.env --export-options-plist=$HOME/export_options.plist --build-name=${{ inputs.build-version }} --build-number=${{ inputs.build-number }}
- name: Publish the app to App Store Connect
working-directory: packages/${{ inputs['package-name'] }}
run: |
APP_FILE=$(find $(pwd) -name "*.ipa")
app-store-connect publish \
--path "$APP_FILE"