Skip to content

Commit

Permalink
Merge pull request #1074 from kiwix/fix-cd-builds
Browse files Browse the repository at this point in the history
Remove support/donation for macOS FTP builds, as it's not supported outside of AppStore
  • Loading branch information
kelson42 authored Jan 17, 2025
2 parents 61bbee0 + 5446417 commit d28093f
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 8 deletions.
3 changes: 0 additions & 3 deletions .github/actions/xcbuild/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,6 @@ inputs:
KEYCHAIN_PASSWORD:
required: false
default: mysecretpassword
KEYCHAIN_PROFILE:
required: false
default: build-profile
XC_WORKSPACE:
required: false
default: Kiwix.xcodeproj/project.xcworkspace/
Expand Down
18 changes: 15 additions & 3 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ name: CD
# |-----------------|---------|------------------------|----------------|---------------------|
# | UPLOAD_FOLDER | nightly | - | - | release/kiwix-macos |
# |-----------------|---------|------------------------|----------------|---------------------|

# Signing certificates:
# - iOS/macOS + app-store: Apple Distribution
# - iOS + FTP: Apple Development
# - macOS + FTP: Developer ID

on:
schedule:
- cron: '32 1 * * *' # Nightly download.kiwix.org @ 01:32
Expand Down Expand Up @@ -52,6 +58,13 @@ jobs:
- name: Install python dependencies
run: pip install pyyaml==6.0.1

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

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

- name: Set macOS FTP export method, and Developer ID Certificate
Expand Down Expand Up @@ -150,7 +163,6 @@ jobs:
DEPLOYMENT_SIGNING_CERTIFICATE_P12_PASSWORD: ${{ env.SIGNING_CERTIFICATE_P12_PASSWORD }}
KEYCHAIN: ${{ env.KEYCHAIN }}
KEYCHAIN_PASSWORD: ${{ env.KEYCHAIN_PASSWORD }}
KEYCHAIN_PROFILE: ${{ env.KEYCHAIN_PROFILE }}
EXTRA_XCODEBUILD: ${{ env.EXTRA_XCODEBUILD }}

- name: Add altool credentials to Keychain
Expand Down
2 changes: 1 addition & 1 deletion App/App_macOS.swift
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ struct RootView: View {
}
.frame(minWidth: 160)
.safeAreaInset(edge: .bottom) {
if Payment.paymentButtonType() != nil {
if Payment.paymentButtonType() != nil && Brand.hideDonation != true {
SupportKiwixButton {
openWindow(id: "donation")
}
Expand Down
6 changes: 6 additions & 0 deletions Model/Brand.swift
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,11 @@ enum Brand {

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

static var defaultExternalLinkPolicy: ExternalLinkLoadingPolicy {
guard let policyString: String = Config.value(for: .externalLinkDefaultPolicy),
Expand Down Expand Up @@ -81,6 +86,7 @@ enum Config: String {
case showSearchSnippetInSettings = "SETTINGS_SHOW_SEARCH_SNIPPET"
case aboutText = "CUSTOM_ABOUT_TEXT"
case aboutWebsite = "CUSTOM_ABOUT_WEBSITE"
case hideDonation = "HIDE_DONATION"

static func value<T>(for key: Config) -> T? where T: LosslessStringConvertible {
guard let object = Bundle.main.object(forInfoDictionaryKey: key.rawValue) else {
Expand Down
2 changes: 1 addition & 1 deletion project.yml
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ targets:
entitlements:
properties:
com.apple.security.files.downloads.read-write: true
com.apple.developer.in-app-payments: [merchant.org.kiwix.apple]
com.apple.developer.in-app-payments: [merchant.org.kiwix.apple] # this line is removed for macOS FTP
settings:
base:
MARKETING_VERSION: "3.7.0"
Expand Down

0 comments on commit d28093f

Please sign in to comment.