Add full release notes link flag to generate_appcast (#2015)

This commit is contained in:
Zorg authored and GitHub committed 2021-11-07 19:52:03 -08:00
1 parent c53ed49e5e
commit 4b9388d9aa
2 files changed
+11 -2

No files matched your search

+7 -1
View File
@@ -49,7 +49,7 @@ func extractVersion(parent: XMLNode) -> String? {
return nil
}
func writeAppcast(appcastDestPath: URL, updates: [ArchiveItem], newVersions: Set<String>?, maxNewVersionsInFeed: Int, link: String?, newChannel: String?, majorVersion: String?, phasedRolloutInterval: Int?, criticalUpdateVersion: String?, informationalUpdateVersions: [String]?) throws -> (numNewUpdates: Int, numExistingUpdates: Int) {
func writeAppcast(appcastDestPath: URL, updates: [ArchiveItem], newVersions: Set<String>?, maxNewVersionsInFeed: Int, fullReleaseNotesLink: String?, link: String?, newChannel: String?, majorVersion: String?, phasedRolloutInterval: Int?, criticalUpdateVersion: String?, informationalUpdateVersions: [String]?) throws -> (numNewUpdates: Int, numExistingUpdates: Int) {
let appBaseName = updates[0].appPath.deletingPathExtension().lastPathComponent
let sparkleNS = "http://www.andymatuschak.org/xml-namespaces/sparkle"
@@ -168,6 +168,12 @@ func writeAppcast(appcastDestPath: URL, updates: [ArchiveItem], newVersions: Set
item.addChild(linkElement)
}
if let fullReleaseNotesLink = fullReleaseNotesLink,
let fullReleaseNotesElement = XMLElement.element(withName: SUAppcastElementFullReleaseNotesLink, uri: sparkleNS) as? XMLElement {
fullReleaseNotesElement.setChildren([text(fullReleaseNotesLink)])
item.addChild(fullReleaseNotesElement)
}
// Set new channel name
if let newChannelName = newChannel,
let channelNameElement = XMLElement.element(withName: SUAppcastElementChannel, uri: sparkleNS) as? XMLElement {
+4 -1
View File
@@ -72,6 +72,9 @@ struct GenerateAppcast: ParsableCommand {
@Option(name: .customLong("release-notes-url-prefix"), help: ArgumentHelp("A URL that will be used as prefix for constructing URLs for release notes.", valueName: "url"), transform: { URL(string: $0) })
var releaseNotesURLPrefix : URL?
@Option(name: .customLong("full-release-notes-url"), help: ArgumentHelp("A URL that will be used for the full release notes.", valueName: "url"))
var fullReleaseNotesURL: String?
@Option(name: .long, help: ArgumentHelp("A URL to the application's website which Sparkle may use for directing users to if they cannot download a new update from within the application. This will be used for new generated update items. By default, no product link is used.", valueName: "link"))
var link: String?
@@ -220,7 +223,7 @@ struct GenerateAppcast: ParsableCommand {
relativeTo: archivesSourceDir)
// Write the appcast
let (numNewUpdates, numExistingUpdates) = try writeAppcast(appcastDestPath: appcastDestPath, updates: updates, newVersions: versions, maxNewVersionsInFeed: maxNewVersionsInFeed, link: link, newChannel: channel, majorVersion: majorVersion, phasedRolloutInterval: phasedRolloutInterval, criticalUpdateVersion: criticalUpdateVersion, informationalUpdateVersions: informationalUpdateVersions)
let (numNewUpdates, numExistingUpdates) = try writeAppcast(appcastDestPath: appcastDestPath, updates: updates, newVersions: versions, maxNewVersionsInFeed: maxNewVersionsInFeed, fullReleaseNotesLink: fullReleaseNotesURL, link: link, newChannel: channel, majorVersion: majorVersion, phasedRolloutInterval: phasedRolloutInterval, criticalUpdateVersion: criticalUpdateVersion, informationalUpdateVersions: informationalUpdateVersions)
// Inform the user, pluralizing "update" if necessary
let pluralizeUpdates = { $0 == 1 ? "update" : "updates" }