forked from git-for-windows/git
-
Notifications
You must be signed in to change notification settings - Fork 97
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build-git-installers: migrate macOS and Linux off ESRP (#614)
This PR migrates `microsoft/git`'s signing workflows off the ESRP service. This means: 1. Updating the Linux components to sign with a GPG key. 2. Updating macOS components to sign/notarize using Application and Installer certificates (see [this series](https://developer.apple.com/forums/thread/701514) for more details). An example run of release workflow with these changes can be found at [1]. 1: https://github.com/microsoft/git/actions/runs/6635788798
- Loading branch information
Showing
8 changed files
with
350 additions
and
504 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>com.apple.security.cs.allow-jit</key> | ||
<true/> | ||
<key>com.apple.security.cs.allow-unsigned-executable-memory</key> | ||
<true/> | ||
<key>com.apple.security.cs.disable-library-validation</key> | ||
<true/> | ||
</dict> | ||
</plist> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
#!/bin/bash | ||
|
||
sign_directory () { | ||
( | ||
cd "$1" | ||
for f in * | ||
do | ||
macho=$(file --mime $f | grep mach) | ||
# Runtime sign dylibs and Mach-O binaries | ||
if [[ $f == *.dylib ]] || [ ! -z "$macho" ]; | ||
then | ||
echo "Runtime Signing $f" | ||
codesign -s "$IDENTITY" $f --timestamp --force --options=runtime --entitlements $ENTITLEMENTS_FILE | ||
elif [ -d "$f" ]; | ||
then | ||
echo "Signing files in subdirectory $f" | ||
sign_directory "$f" | ||
|
||
else | ||
echo "Signing $f" | ||
codesign -s "$IDENTITY" $f --timestamp --force | ||
fi | ||
done | ||
) | ||
} | ||
|
||
for i in "$@" | ||
do | ||
case "$i" in | ||
--payload=*) | ||
SIGN_DIR="${i#*=}" | ||
shift # past argument=value | ||
;; | ||
--identity=*) | ||
IDENTITY="${i#*=}" | ||
shift # past argument=value | ||
;; | ||
--entitlements=*) | ||
ENTITLEMENTS_FILE="${i#*=}" | ||
shift # past argument=value | ||
;; | ||
*) | ||
die "unknown option '$i'" | ||
;; | ||
esac | ||
done | ||
|
||
if [ -z "$SIGN_DIR" ]; then | ||
echo "error: missing directory argument" | ||
exit 1 | ||
elif [ -z "$IDENTITY" ]; then | ||
echo "error: missing signing identity argument" | ||
exit 1 | ||
elif [ -z "$ENTITLEMENTS_FILE" ]; then | ||
echo "error: missing entitlements file argument" | ||
exit 1 | ||
fi | ||
|
||
echo "======== INPUTS ========" | ||
echo "Directory: $SIGN_DIR" | ||
echo "Signing identity: $IDENTITY" | ||
echo "Entitlements: $ENTITLEMENTS_FILE" | ||
echo "======== END INPUTS ========" | ||
|
||
sign_directory "$SIGN_DIR" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#!/bin/bash | ||
|
||
for i in "$@" | ||
do | ||
case "$i" in | ||
--package=*) | ||
PACKAGE="${i#*=}" | ||
shift # past argument=value | ||
;; | ||
--keychain-profile=*) | ||
KEYCHAIN_PROFILE="${i#*=}" | ||
shift # past argument=value | ||
;; | ||
*) | ||
die "unknown option '$i'" | ||
;; | ||
esac | ||
done | ||
|
||
if [ -z "$PACKAGE" ]; then | ||
echo "error: missing package argument" | ||
exit 1 | ||
elif [ -z "$KEYCHAIN_PROFILE" ]; then | ||
echo "error: missing keychain profile argument" | ||
exit 1 | ||
fi | ||
|
||
# Exit as soon as any line fails | ||
set -e | ||
|
||
# Send the notarization request | ||
xcrun notarytool submit -v "$PACKAGE" -p "$KEYCHAIN_PROFILE" --wait | ||
|
||
# Staple the notarization ticket (to allow offline installation) | ||
xcrun stapler staple -v "$PACKAGE" |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.