Skip to content

Instantly share code, notes, and snippets.

@mikehearn
Created December 4, 2022 13:19
Show Gist options
  • Save mikehearn/bea0ac83d66e106f0e24deb1fd3439b1 to your computer and use it in GitHub Desktop.
Save mikehearn/bea0ac83d66e106f0e24deb1fd3439b1 to your computer and use it in GitHub Desktop.
Config for GH Desktop (using GH Actions to prepare the resources dir)
// A config for Conveyor (https://conveyor.hydraulic.dev/) that creates a download site for GitHub Desktop.
// Shows how to package a real-world and sophisticated Electron app.
include required("/stdlib/electron/electron.conf")
// Import package.json files so we can avoid duplicating config. There are two in this project.
package-json {
include required("app/package.json")
}
outer-package-json {
include required("package.json")
}
// GH Desktop build system does different things and even produces different minified JS depending on the
// host platform. We could make it genuinely cross-build but it'd mean patching the Desktop build system,
// so to keep it simple we run part of the build process on CI. GH Actions doesn't make it easy to directly
// download outputs but nightly.link is here to save the day.
ci-artifacts-url = nightly.link/hydraulic-software/github-desktop/workflows/ci/conveyorize
// Package definition starts here.
app {
// App files.
//
// Why so complicated? GitHub Actions can only export a zip from a step, and it doesn't
// preserve UNIX metadata. So we have to wrap the Mac version in a tarball, which is
// then placed inside a zip. To support this Conveyor allows unwrapping multiple levels
// of archive with extract=2.
mac.amd64.inputs = [{
from = ${ci-artifacts-url}/build-out-macOS-x64.zip
extract = 2
}]
mac.aarch64.inputs = [{
from = ${ci-artifacts-url}/build-out-macOS-arm64.zip
extract = 2
}]
// On Windows we don't need the tarball-within-a-zip trick. One level of zip is extracted automatically.
windows.amd64.inputs = ${ci-artifacts-url}/build-out-Windows-x64.zip
// Names.
fsname = github-desktop
rdns-name = ${package-json.bundleID}
display-name = ${package-json.productName}
vendor = ${package-json.companyName}
// Versions. Must set this explicitly because you can't use words like "beta" in version numbers.
version = 3.1.3
// GH Desktop doesn't support Linux :(
machines = [ windows.amd64, mac.amd64, mac.aarch64 ]
electron.version = ${outer-package-json.devDependencies.electron}
updates = aggressive // just for testing
// Icons
icons = "app/static/logos/{256x256,512x512,1024x1024}.png"
// vcs-url = open source = free Conveyor license. Also setting vcs-url means packages check latest GitHub Release for updates.
vcs-url = "https://github.com/hydraulic-software/github-desktop"
license = MIT
contact-email = ${package-json.author.email}
// URL handlers for logging in.
url-schemes = [
x-github-desktop-auth
x-github-desktop-dev-auth
x-github-client
github-mac
github-windows
]
mac {
entitlements-plist."com.apple.security.automation.apple-events" = true
info-plist {
NSAppleEventsUsageDescription = GitHub Desktop uses Apple Events to implement integration features with external editors.
// Enable opening Desktop via the Finder.
CFBundleDocumentTypes = [
{
CFBundleTypeName = Folders
CFBundleTypeRole = Viewer
LSItemContentTypes = [ public.folder ]
LSHandlerRank = Alternate
}
]
LSApplicationCategoryType = public.app-category.developer-tools
NSHumanReadableCopyright = "Copyright © 2017- GitHub, Inc."
}
}
// TODO: CLI tool
}
conveyor.compatibility-level = 5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment