Skip to content

Commit d28093f

Browse files
authored
Merge pull request #1074 from kiwix/fix-cd-builds
Remove support/donation for macOS FTP builds, as it's not supported outside of AppStore
2 parents 61bbee0 + 5446417 commit d28093f

File tree

5 files changed

+23
-8
lines changed

5 files changed

+23
-8
lines changed

.github/actions/xcbuild/action.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,6 @@ inputs:
2525
KEYCHAIN_PASSWORD:
2626
required: false
2727
default: mysecretpassword
28-
KEYCHAIN_PROFILE:
29-
required: false
30-
default: build-profile
3128
XC_WORKSPACE:
3229
required: false
3330
default: Kiwix.xcodeproj/project.xcworkspace/

.github/workflows/cd.yml

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,12 @@ name: CD
99
# |-----------------|---------|------------------------|----------------|---------------------|
1010
# | UPLOAD_FOLDER | nightly | - | - | release/kiwix-macos |
1111
# |-----------------|---------|------------------------|----------------|---------------------|
12+
13+
# Signing certificates:
14+
# - iOS/macOS + app-store: Apple Distribution
15+
# - iOS + FTP: Apple Development
16+
# - macOS + FTP: Developer ID
17+
1218
on:
1319
schedule:
1420
- cron: '32 1 * * *' # Nightly download.kiwix.org @ 01:32
@@ -52,6 +58,13 @@ jobs:
5258
- name: Install python dependencies
5359
run: pip install pyyaml==6.0.1
5460

61+
# https://developer.apple.com/help/account/reference/supported-capabilities-macos
62+
- name: Remove In App Purchase capability for macOS FTP (Developer ID signing)
63+
if: matrix.platform == 'macOS' && matrix.destination == 'ftp'
64+
run: |
65+
sed -i '' '/in-app-payments/d' project.yml
66+
plutil -insert HIDE_DONATION -bool true Support/Info.plist
67+
5568
- name: Set VERSION from code
5669
shell: python
5770
run: |
@@ -111,8 +124,8 @@ jobs:
111124
if: matrix.platform == 'iOS' && contains(env.UPLOAD_TO, matrix.destination)
112125
run: echo "EXTRA_XCODEBUILD=-sdk iphoneos ${{ env.APPLE_AUTH_PARAMS }}" >> $GITHUB_ENV
113126

114-
- name: Set EXTRA_XCODEBUILD for macOS AppStore
115-
if: matrix.platform == 'macOS' && matrix.destination == 'app-store'
127+
- name: Set macOS extra xcode params
128+
if: matrix.platform == 'macOS' && contains(env.UPLOAD_TO, matrix.destination)
116129
run: echo "EXTRA_XCODEBUILD=${{ env.APPLE_AUTH_PARAMS }}" >> $GITHUB_ENV
117130

118131
- name: Set macOS FTP export method, and Developer ID Certificate
@@ -150,7 +163,6 @@ jobs:
150163
DEPLOYMENT_SIGNING_CERTIFICATE_P12_PASSWORD: ${{ env.SIGNING_CERTIFICATE_P12_PASSWORD }}
151164
KEYCHAIN: ${{ env.KEYCHAIN }}
152165
KEYCHAIN_PASSWORD: ${{ env.KEYCHAIN_PASSWORD }}
153-
KEYCHAIN_PROFILE: ${{ env.KEYCHAIN_PROFILE }}
154166
EXTRA_XCODEBUILD: ${{ env.EXTRA_XCODEBUILD }}
155167

156168
- name: Add altool credentials to Keychain

App/App_macOS.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ struct RootView: View {
196196
}
197197
.frame(minWidth: 160)
198198
.safeAreaInset(edge: .bottom) {
199-
if Payment.paymentButtonType() != nil {
199+
if Payment.paymentButtonType() != nil && Brand.hideDonation != true {
200200
SupportKiwixButton {
201201
openWindow(id: "donation")
202202
}

Model/Brand.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,11 @@ enum Brand {
5151

5252
static let aboutText: String = Config.value(for: .aboutText) ?? "settings.about.description".localized
5353
static let aboutWebsite: String = Config.value(for: .aboutWebsite) ?? "https://www.kiwix.org"
54+
// currently only used under the Kiwix brand
55+
// if this is set to true in Support/Info.plist the support/donation button is hidden (for macOS FTP)
56+
// if not set, we fall back to false, and display the support/donation button
57+
// for non Kiwix brands, it has no effect
58+
static let hideDonation: Bool = Config.value(for: .hideDonation) ?? false
5459

5560
static var defaultExternalLinkPolicy: ExternalLinkLoadingPolicy {
5661
guard let policyString: String = Config.value(for: .externalLinkDefaultPolicy),
@@ -81,6 +86,7 @@ enum Config: String {
8186
case showSearchSnippetInSettings = "SETTINGS_SHOW_SEARCH_SNIPPET"
8287
case aboutText = "CUSTOM_ABOUT_TEXT"
8388
case aboutWebsite = "CUSTOM_ABOUT_WEBSITE"
89+
case hideDonation = "HIDE_DONATION"
8490

8591
static func value<T>(for key: Config) -> T? where T: LosslessStringConvertible {
8692
guard let object = Bundle.main.object(forInfoDictionaryKey: key.rawValue) else {

project.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ targets:
9898
entitlements:
9999
properties:
100100
com.apple.security.files.downloads.read-write: true
101-
com.apple.developer.in-app-payments: [merchant.org.kiwix.apple]
101+
com.apple.developer.in-app-payments: [merchant.org.kiwix.apple] # this line is removed for macOS FTP
102102
settings:
103103
base:
104104
MARKETING_VERSION: "3.7.0"

0 commit comments

Comments
 (0)