mirror of
https://github.com/yuezk/GlobalProtect-openconnect.git
synced 2026-11-19 14:36:15 -05:00
ci: sign snapshot macOS builds for development
This commit is contained in:
2 files changed
+63
-26
No files matched your search
@@ -11,7 +11,7 @@ on:
|
|||||||
required: true
|
required: true
|
||||||
default: dev
|
default: dev
|
||||||
build_macos:
|
build_macos:
|
||||||
description: 'Build signed and notarized Apple Silicon artifacts for the snapshot release'
|
description: 'Build Apple Silicon artifacts for the snapshot release'
|
||||||
required: true
|
required: true
|
||||||
default: false
|
default: false
|
||||||
type: boolean
|
type: boolean
|
||||||
@@ -442,25 +442,30 @@ jobs:
|
|||||||
|
|
||||||
for variable in \
|
for variable in \
|
||||||
MACOS_CERTIFICATE_P12 \
|
MACOS_CERTIFICATE_P12 \
|
||||||
MACOS_CERTIFICATE_PASSWORD \
|
MACOS_CERTIFICATE_PASSWORD; do
|
||||||
APPLE_NOTARY_KEY_P8 \
|
|
||||||
APPLE_NOTARY_KEY_ID \
|
|
||||||
APPLE_NOTARY_ISSUER_ID; do
|
|
||||||
if [[ -z "${!variable:-}" ]]; then
|
if [[ -z "${!variable:-}" ]]; then
|
||||||
echo "$variable is not configured" >&2
|
echo "$variable is not configured" >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
if [[ "$UPDATE_CHANNEL" == "stable" ]]; then
|
||||||
|
for variable in \
|
||||||
|
APPLE_NOTARY_KEY_P8 \
|
||||||
|
APPLE_NOTARY_KEY_ID \
|
||||||
|
APPLE_NOTARY_ISSUER_ID; do
|
||||||
|
if [[ -z "${!variable:-}" ]]; then
|
||||||
|
echo "$variable is not configured" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
keychain="$RUNNER_TEMP/gp-connect.keychain-db"
|
keychain="$RUNNER_TEMP/gp-connect.keychain-db"
|
||||||
keychain_password="$(openssl rand -hex 24)"
|
keychain_password="$(openssl rand -hex 24)"
|
||||||
certificate="$RUNNER_TEMP/developer-id.p12"
|
certificate="$RUNNER_TEMP/signing-identity.p12"
|
||||||
notary_key="$RUNNER_TEMP/AuthKey.p8"
|
|
||||||
notary_profile="gp-connect-ci"
|
|
||||||
|
|
||||||
printf '%s' "$MACOS_CERTIFICATE_P12" | base64 -D > "$certificate"
|
printf '%s' "$MACOS_CERTIFICATE_P12" | base64 -D > "$certificate"
|
||||||
printf '%s' "$APPLE_NOTARY_KEY_P8" > "$notary_key"
|
chmod 600 "$certificate"
|
||||||
chmod 600 "$certificate" "$notary_key"
|
|
||||||
|
|
||||||
security create-keychain -p "$keychain_password" "$keychain"
|
security create-keychain -p "$keychain_password" "$keychain"
|
||||||
security set-keychain-settings -lut 21600 "$keychain"
|
security set-keychain-settings -lut 21600 "$keychain"
|
||||||
@@ -471,33 +476,55 @@ jobs:
|
|||||||
-s -k "$keychain_password" "$keychain"
|
-s -k "$keychain_password" "$keychain"
|
||||||
security list-keychains -d user -s "$keychain" login.keychain-db
|
security list-keychains -d user -s "$keychain" login.keychain-db
|
||||||
|
|
||||||
identity="$(security find-identity -v -p codesigning "$keychain" \
|
if [[ "$UPDATE_CHANNEL" == "stable" ]]; then
|
||||||
| sed -n 's/.*"\(Developer ID Application:.*\)"/\1/p' | head -1)"
|
identity="$(security find-identity -v -p codesigning "$keychain" \
|
||||||
|
| sed -n 's/.*"\(Developer ID Application:.*\)"/\1/p' | head -1)"
|
||||||
|
else
|
||||||
|
identity="$(security find-identity -v -p codesigning "$keychain" \
|
||||||
|
| sed -n \
|
||||||
|
-e 's/.*"\(Developer ID Application:.*\)"/\1/p' \
|
||||||
|
-e 's/.*"\(Apple Development:.*\)"/\1/p' \
|
||||||
|
| head -1)"
|
||||||
|
fi
|
||||||
if [[ -z "$identity" ]]; then
|
if [[ -z "$identity" ]]; then
|
||||||
echo "Developer ID Application identity was not found" >&2
|
echo "A compatible Apple code-signing identity was not found" >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
xcrun notarytool store-credentials "$notary_profile" \
|
|
||||||
--key "$notary_key" \
|
|
||||||
--key-id "$APPLE_NOTARY_KEY_ID" \
|
|
||||||
--issuer "$APPLE_NOTARY_ISSUER_ID" \
|
|
||||||
--keychain "$keychain"
|
|
||||||
|
|
||||||
{
|
{
|
||||||
echo "CI_KEYCHAIN=$keychain"
|
echo "CI_KEYCHAIN=$keychain"
|
||||||
echo "MACOS_SIGN_IDENTITY=$identity"
|
echo "MACOS_SIGN_IDENTITY=$identity"
|
||||||
echo "APPLE_NOTARY_PROFILE=$notary_profile"
|
|
||||||
echo "APPLE_NOTARY_KEYCHAIN=$keychain"
|
|
||||||
} >> "$GITHUB_ENV"
|
} >> "$GITHUB_ENV"
|
||||||
|
|
||||||
- name: Build signed and notarized application
|
if [[ "$UPDATE_CHANNEL" == "stable" ]]; then
|
||||||
|
notary_key="$RUNNER_TEMP/AuthKey.p8"
|
||||||
|
notary_profile="gp-connect-ci"
|
||||||
|
printf '%s' "$APPLE_NOTARY_KEY_P8" > "$notary_key"
|
||||||
|
chmod 600 "$notary_key"
|
||||||
|
xcrun notarytool store-credentials "$notary_profile" \
|
||||||
|
--key "$notary_key" \
|
||||||
|
--key-id "$APPLE_NOTARY_KEY_ID" \
|
||||||
|
--issuer "$APPLE_NOTARY_ISSUER_ID" \
|
||||||
|
--keychain "$keychain"
|
||||||
|
{
|
||||||
|
echo "APPLE_NOTARY_PROFILE=$notary_profile"
|
||||||
|
echo "APPLE_NOTARY_KEYCHAIN=$keychain"
|
||||||
|
} >> "$GITHUB_ENV"
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: Build macOS release artifacts
|
||||||
env:
|
env:
|
||||||
SPARKLE_PUBLIC_KEY: ${{ vars.SPARKLE_PUBLIC_KEY }}
|
SPARKLE_PUBLIC_KEY: ${{ vars.SPARKLE_PUBLIC_KEY }}
|
||||||
run: |
|
run: |
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
cd gpgui-source/gpgui
|
cd gpgui-source/gpgui
|
||||||
./scripts/build-macos.sh dmg release
|
if [[ "$UPDATE_CHANNEL" == "stable" ]]; then
|
||||||
|
build_mode="release"
|
||||||
|
else
|
||||||
|
build_mode="development"
|
||||||
|
export SPARKLE_CREATE_UPDATE_ARCHIVE=1
|
||||||
|
fi
|
||||||
|
./scripts/build-macos.sh dmg "$build_mode"
|
||||||
|
|
||||||
- name: Prepare release assets
|
- name: Prepare release assets
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
@@ -127,11 +127,21 @@ jobs:
|
|||||||
app="$extract_dir/GP Connect.app"
|
app="$extract_dir/GP Connect.app"
|
||||||
test -d "$app"
|
test -d "$app"
|
||||||
codesign --verify --deep --strict --verbose=2 "$app"
|
codesign --verify --deep --strict --verbose=2 "$app"
|
||||||
xcrun stapler validate "$app"
|
|
||||||
|
|
||||||
signing_info="$(codesign -d --verbose=4 "$app" 2>&1)"
|
signing_info="$(codesign -d --verbose=4 "$app" 2>&1)"
|
||||||
grep -q '^Authority=Developer ID Application:' <<<"$signing_info"
|
if [[ "$CHANNEL" == "stable" ]]; then
|
||||||
grep -q '^CodeDirectory .*flags=.*runtime' <<<"$signing_info"
|
xcrun stapler validate "$app"
|
||||||
|
grep -q '^Authority=Developer ID Application:' <<<"$signing_info"
|
||||||
|
grep -q '^CodeDirectory .*flags=.*runtime' <<<"$signing_info"
|
||||||
|
else
|
||||||
|
grep -E -q '^Authority=(Apple Development|Developer ID Application):' \
|
||||||
|
<<<"$signing_info"
|
||||||
|
fi
|
||||||
|
team_identifier="$(sed -n 's/^TeamIdentifier=//p' <<<"$signing_info")"
|
||||||
|
if [[ -z "$team_identifier" || "$team_identifier" == "not set" ]]; then
|
||||||
|
echo "Signed application has no Team Identifier" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
identifier="$(sed -n 's/^Identifier=//p' <<<"$signing_info")"
|
identifier="$(sed -n 's/^Identifier=//p' <<<"$signing_info")"
|
||||||
if [[ "$identifier" != "com.yuezk.gpgui" ]]; then
|
if [[ "$identifier" != "com.yuezk.gpgui" ]]; then
|
||||||
|
|||||||
Reference in new issue
Block a user