Skip to content

ci: sign builds for distribution via sparkle #165

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 23, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,5 @@ APPLE_ID_PASSWORD="op://Apple/3apcadvvcojjbpxnd7m5fgh5wm/password"

APP_PROF="op://Apple/Provisioning Profiles/profiles/application_base64"
EXT_PROF="op://Apple/Provisioning Profiles/profiles/extension_base64"

SPARKLE_PRIVATE_KEY="op://Apple/Private key for signing Sparkle updates/notesPlain"
1 change: 1 addition & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ jobs:
APPLE_ID_PASSWORD: ${{ secrets.APPLE_NOTARYTOOL_PASSWORD }}
APP_PROF: ${{ secrets.CODER_DESKTOP_APP_PROVISIONPROFILE_B64 }}
EXT_PROF: ${{ secrets.CODER_DESKTOP_EXTENSION_PROVISIONPROFILE_B64 }}
SPARKLE_PRIVATE_KEY: ${{ secrets.SPARKLE_PRIVATE_KEY }}
run: make release

# Upload as artifact in dry-run mode
Expand Down
2 changes: 2 additions & 0 deletions Coder-Desktop/Coder-Desktop/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,7 @@
<key>NEMachServiceName</key>
<string>$(TeamIdentifierPrefix)com.coder.Coder-Desktop.VPN</string>
</dict>
<key>SUPublicEDKey</key>
<string>Ae2oQLTcx89/a73XrpOt+IVvqdo+fMTjo3UKEm77VdA=</string>
</dict>
</plist>
4 changes: 4 additions & 0 deletions Coder-Desktop/project.yml
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,9 @@ packages:
URLRouting:
url: https://github.com/pointfreeco/swift-url-routing
revision: 09b155d
Sparkle:
url: https://github.com/sparkle-project/Sparkle
exactVersion: 2.7.0


targets:
Expand Down Expand Up @@ -202,6 +205,7 @@ targets:
- package: LaunchAtLogin
- package: SDWebImageSwiftUI
- package: SDWebImageSVGCoder
- package: Sparkle
scheme:
testPlans:
- path: Coder-Desktop.xctestplan
Expand Down
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,8 @@ release: $(KEYCHAIN_FILE) ## Create a release build of Coder Desktop
--app-prof-path "$$APP_PROF_PATH" \
--ext-prof-path "$$EXT_PROF_PATH" \
--version $(MARKETING_VERSION) \
--keychain "$(APP_SIGNING_KEYCHAIN)"; \
--keychain "$(APP_SIGNING_KEYCHAIN)" \
--sparkle-private-key "$$SPARKLE_PRIVATE_KEY"; \
rm "$$APP_PROF_PATH" "$$EXT_PROF_PATH"

.PHONY: fmt
Expand Down
21 changes: 15 additions & 6 deletions scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,17 @@ APP_PROF_PATH=${APP_PROF_PATH:-""}
EXT_PROF_PATH=${EXT_PROF_PATH:-""}
KEYCHAIN=${KEYCHAIN:-""}
VERSION=${VERSION:-""}
SPARKLE_PRIVATE_KEY=${SPARKLE_PRIVATE_KEY:-""}

# Function to display usage
usage() {
echo "Usage: $0 [--app-prof-path <path>] [--ext-prof-path <path>] [--keychain <path>]"
echo " --app-prof-path <path> Set the APP_PROF_PATH variable"
echo " --ext-prof-path <path> Set the EXT_PROF_PATH variable"
echo " --keychain <path> Set the KEYCHAIN variable"
echo " --version <version> Set the VERSION variable to fetch and generate the cask file for"
echo " -h, --help Display this help message"
echo " --app-prof-path <path> Set the APP_PROF_PATH variable"
echo " --ext-prof-path <path> Set the EXT_PROF_PATH variable"
echo " --keychain <path> Set the KEYCHAIN variable"
echo " --sparkle-private-key <path> Set the SPARKLE_PRIVATE_KEY variable"
echo " --version <version> Set the VERSION variable to fetch and generate the cask file for"
echo " -h, --help Display this help message"
}

# Parse command line arguments
Expand All @@ -42,6 +44,10 @@ while [[ "$#" -gt 0 ]]; do
KEYCHAIN="$2"
shift 2
;;
--sparkle-private-key)
SPARKLE_PRIVATE_KEY="$2"
shift 2
;;
--version)
VERSION="$2"
shift 2
Expand All @@ -59,7 +65,7 @@ while [[ "$#" -gt 0 ]]; do
done

# Check if required variables are set
if [[ -z "$APP_PROF_PATH" || -z "$EXT_PROF_PATH" || -z "$KEYCHAIN" ]]; then
if [[ -z "$APP_PROF_PATH" || -z "$EXT_PROF_PATH" || -z "$KEYCHAIN" || -z "$SPARKLE_PRIVATE_KEY" ]]; then
echo "Missing required values"
echo "APP_PROF_PATH: $APP_PROF_PATH"
echo "EXT_PROF_PATH: $EXT_PROF_PATH"
Expand Down Expand Up @@ -195,6 +201,9 @@ xcrun notarytool submit "$PKG_PATH" \
xcrun stapler staple "$PKG_PATH"
xcrun stapler staple "$BUILT_APP_PATH"

signature=$(echo "$SPARKLE_PRIVATE_KEY" | ~/Library/Developer/Xcode/DerivedData/Coder-Desktop-*/SourcePackages/artifacts/sparkle/Sparkle/bin/sign_update "$PKG_PATH" --ed-key-file -)
echo "$signature" >"$PKG_PATH.sig"

# Add dsym to build artifacts
(cd "$ARCHIVE_PATH/dSYMs" && zip -9 -r --symlinks "$DSYM_ZIPPED_PATH" ./*)

Expand Down
Loading