-
Notifications
You must be signed in to change notification settings - Fork 0
175 lines (158 loc) · 6.21 KB
/
publishing.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
name: Publishing
on:
push:
branches:
- develop
- hotfix/*
- release/*
tags:
- v*.*.*
jobs:
build:
name: Build
runs-on: macos-latest
environment: apple-app-store
strategy:
matrix:
platform:
- iOS
- macOS
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: true
- name: Cache packages
uses: actions/cache@v4
with:
path: |
~/Library/Developer/Xcode/DerivedData/**/SourcePackages/checkouts
key: ${{ runner.os }}-spm-${{ hashFiles('**/Package.resolved') }}
restore-keys: |
${{ runner.os }}-spm-
- name: Set up signing certificate
env:
CERTIFICATE_PRIVATE_KEY_B64: ${{ secrets.CERTIFICATE_PRIVATE_KEY_B64 }}
CERTIFICATE_MAC_INSTALLER_PRIVATE_KEY_B64: ${{ secrets.CERTIFICATE_MAC_INSTALLER_PRIVATE_KEY_B64 }}
run: |
security create-keychain -p password build.keychain
security default-keychain -s build.keychain
security unlock-keychain -p password build.keychain
security set-keychain-settings build.keychain
echo $CERTIFICATE_PRIVATE_KEY_B64 | base64 --decode > /tmp/cert-fyreplace.p12
security import /tmp/cert-fyreplace.p12 -k build.keychain -P '' -T /usr/bin/codesign
echo $CERTIFICATE_MAC_INSTALLER_PRIVATE_KEY_B64 | base64 --decode > /tmp/cert-fyreplace.p12
security import /tmp/cert-fyreplace.p12 -k build.keychain -P '' -T /usr/bin/codesign
security set-key-partition-list -S apple-tool:,apple: -s -k password build.keychain
- name: Set up App Store Connect authentication
env:
APP_STORE_CONNECT_PRIVATE_KEY_B64: ${{ secrets.APP_STORE_CONNECT_PRIVATE_KEY_B64 }}
run: echo $APP_STORE_CONNECT_PRIVATE_KEY_B64 | base64 --decode > /tmp/connect-key.p8
- name: Prepare files
run: make
- name: Test app
if: ${{ matrix.platform = "iOS" }}
run: |
xcodebuild test \
-scheme Fyreplace \
-destination 'platform=${{ matrix.platform }} Simulator,name=${{ vars.IOS_SIMULATOR }}'
xcrun simctl shutdown all
- name: Test app
if: ${{ matrix.platform = "macOS" }}
run: |
xcodebuild test \
DEVELOPMENT_TEAM=${{ vars.TEAM_ID }} \
-allowProvisioningUpdates \
-authenticationKeyPath /tmp/connect-key.p8 \
-authenticationKeyID ${{ vars.APP_STORE_CONNECT_KEY_ID }} \
-authenticationKeyIssuerID ${{ vars.APP_STORE_CONNECT_ISSUER_ID }} \
-scheme Fyreplace \
-destination platform=${{ matrix.platform }}
- name: Build app
run: |
xcodebuild archive \
DEVELOPMENT_TEAM=${{ vars.TEAM_ID }} \
-allowProvisioningUpdates \
-authenticationKeyPath /tmp/connect-key.p8 \
-authenticationKeyID ${{ vars.APP_STORE_CONNECT_KEY_ID }} \
-authenticationKeyIssuerID ${{ vars.APP_STORE_CONNECT_ISSUER_ID }} \
-scheme Fyreplace \
-destination generic/platform=${{ matrix.platform }} \
-archivePath archive.xcarchive
- name: Export to IPA
if: ${{ matrix.platform = "iOS" }}
run: |
/usr/libexec/PlistBuddy -c "Add :method string" ExportOptions.plist
/usr/libexec/PlistBuddy -c "Set :method app-store-connect" ExportOptions.plist
/usr/libexec/PlistBuddy -c "Add :teamId string" ExportOptions.plist
/usr/libexec/PlistBuddy -c "Set :teamId ${{ vars.TEAM_ID }}" ExportOptions.plist
/usr/libexec/PlistBuddy -c "Add :provisioningProfiles dict" ExportOptions.plist
/usr/libexec/PlistBuddy -c "Add :provisioningProfiles:${{ vars.APP_ID }} string ${{ vars.PROVISIONING_PROFILE_NAME }}" ExportOptions.plist
xcodebuild export \
-allowProvisioningUpdates \
-authenticationKeyPath /tmp/connect-key.p8 \
-authenticationKeyID ${{ vars.APP_STORE_CONNECT_KEY_ID }} \
-authenticationKeyIssuerID ${{ vars.APP_STORE_CONNECT_ISSUER_ID }} \
-archivePath archive.xcarchive \
-exportArchive \
-exportOptionsPlist ExportOptions.plist \
-exportPath export
- name: Export to PKG
if: ${{ matrix.platform = "macOS" }}
run: |
xcrun productbuild \
--component archive.xcarchive/Products/Applications/Fyreplace.app \
/Applications \
export/Fyreplace.unsigned
xcrun productsign \
--sign ${{ vars.TEAM_ID }} \
export/Fyreplace.unsigned \
export/Fyreplace.pkg
- uses: actions/upload-artifact@v4
if: ${{ matrix.platform = "iOS" }}
with:
name: Fyreplace.ipa
path: export/*.ipa
if-no-files-found: error
- uses: actions/upload-artifact@v4
if: ${{ matrix.platform = "macOS" }}
with:
name: Fyreplace.pkg
path: export/*.pkg
if-no-files-found: error
publish:
name: Publish
needs: build
runs-on: macos-latest
environment: apple-app-store
strategy:
matrix:
platform:
- ios
- osx
steps:
- uses: actions/download-artifact@v4
if: ${{ matrix.platform = "ios" }}
with:
name: Fyreplace.ipa
path: /tmp
- uses: actions/download-artifact@v4
if: ${{ matrix.platform = "osx" }}
with:
name: Fyreplace.pkg
path: /tmp
- name: Set up App Store Connect authentication
env:
APP_STORE_CONNECT_PRIVATE_KEY_B64: ${{ secrets.APP_STORE_CONNECT_PRIVATE_KEY_B64 }}
run: |
mkdir ~/private_keys
echo $APP_STORE_CONNECT_PRIVATE_KEY_B64 | base64 --decode > ~/private_keys/AuthKey_${{ vars.APP_STORE_CONNECT_KEY_ID }}.p8
- name: Upload to App Store Connect
run: |
xcrun altool \
--upload-app \
--type ${{ matrix.platform }} \
--file /tmp/Fyreplace.* \
--apiKey ${{ vars.APP_STORE_CONNECT_KEY_ID }} \
--apiIssuer ${{ vars.APP_STORE_CONNECT_ISSUER_ID }}