-
Notifications
You must be signed in to change notification settings - Fork 1
137 lines (125 loc) · 5.77 KB
/
Copy pathrelease.yml
File metadata and controls
137 lines (125 loc) · 5.77 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
name: release
on:
push:
tags:
- "v*"
permissions:
contents: write
concurrency:
group: release-${{ github.ref }}
cancel-in-progress: false
jobs:
macos:
runs-on: macos-15
timeout-minutes: 90
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
- name: Verify release version
run: |
version=$(/usr/libexec/PlistBuddy -c 'Print :CFBundleShortVersionString' Resources/Info.plist)
test "$GITHUB_REF_NAME" = "v$version"
- name: Test core behavior
run: ./Scripts/test.sh
- name: Build notarized release and signed update feed
env:
APPLE_APP_SPECIFIC_PASSWORD: ${{ secrets.APPLE_APP_SPECIFIC_PASSWORD }}
APPLE_DEVELOPER_ID_CERTIFICATE: ${{ secrets.APPLE_DEVELOPER_ID_CERTIFICATE }}
APPLE_DEVELOPER_ID_CERTIFICATE_PASSWORD: ${{ secrets.APPLE_DEVELOPER_ID_CERTIFICATE_PASSWORD }}
APPLE_ID: ${{ secrets.APPLE_ID }}
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
CODEWINDOW_POSTHOG_KEY: ${{ secrets.CODEWINDOW_POSTHOG_KEY }}
CODEWINDOW_POSTHOG_HOST: ${{ vars.CODEWINDOW_POSTHOG_HOST }}
SPARKLE_PRIVATE_KEY: ${{ secrets.SPARKLE_PRIVATE_KEY }}
run: |
set -euo pipefail
for variable in \
APPLE_APP_SPECIFIC_PASSWORD \
APPLE_DEVELOPER_ID_CERTIFICATE \
APPLE_DEVELOPER_ID_CERTIFICATE_PASSWORD \
APPLE_ID \
APPLE_TEAM_ID \
CODEWINDOW_POSTHOG_KEY \
SPARKLE_PRIVATE_KEY; do
test -n "${!variable}"
done
certificate_path="$RUNNER_TEMP/codewindow-developer-id.p12"
keychain_path="$RUNNER_TEMP/codewindow-signing.keychain-db"
keychain_password="$(uuidgen)"
cleanup() {
security delete-keychain "$keychain_path" >/dev/null 2>&1 || true
/usr/bin/find "$certificate_path" -delete 2>/dev/null || true
}
trap cleanup EXIT
printf '%s' "$APPLE_DEVELOPER_ID_CERTIFICATE" | /usr/bin/base64 --decode > "$certificate_path"
security create-keychain -p "$keychain_password" "$keychain_path"
security set-keychain-settings -lut 21600 "$keychain_path"
security unlock-keychain -p "$keychain_password" "$keychain_path"
security import "$certificate_path" \
-k "$keychain_path" \
-P "$APPLE_DEVELOPER_ID_CERTIFICATE_PASSWORD" \
-T /usr/bin/codesign
security set-key-partition-list \
-S apple-tool:,apple:,codesign: \
-s \
-k "$keychain_password" \
"$keychain_path"
security list-keychains -d user -s "$keychain_path"
xcrun notarytool store-credentials codewindow-ci \
--apple-id "$APPLE_ID" \
--team-id "$APPLE_TEAM_ID" \
--password "$APPLE_APP_SPECIFIC_PASSWORD" \
--keychain "$keychain_path"
signing_identity="$(security find-identity -v -p codesigning "$keychain_path" | awk '/Developer ID Application:/ { print $2; exit }')"
test -n "$signing_identity"
export CODEWINDOW_EXPECTED_TEAM_ID="$APPLE_TEAM_ID"
export CODEWINDOW_NOTARY_KEYCHAIN="$keychain_path"
export CODEWINDOW_NOTARY_PROFILE="codewindow-ci"
export CODEWINDOW_REQUIRE_NOTARIZATION=1
export CODEWINDOW_SIGN_IDENTITY="$signing_identity"
./Scripts/package-release.sh
test -s build/appcast.xml
test -s build/notary-log.json
test -s build/dmg-notary-log.json
xcrun stapler validate build/CodeWindow.app
spctl --assess --type execute --verbose=4 build/CodeWindow.app
- name: Verify distributable disk image
run: |
set -euo pipefail
version=$(/usr/libexec/PlistBuddy -c 'Print :CFBundleShortVersionString' Resources/Info.plist)
disk_image="build/CodeWindow-v${version}-macOS-universal.dmg"
test -s "$disk_image"
(cd build && shasum -a 256 -c "CodeWindow-v${version}-macOS-universal.dmg.sha256")
xcrun stapler validate "$disk_image"
codesign --verify --strict --verbose=2 "$disk_image"
spctl --assess --type open --context context:primary-signature --verbose=4 "$disk_image"
mount_point="$RUNNER_TEMP/codewindow-dmg"
mkdir -p "$mount_point"
cleanup_mount() {
hdiutil detach "$mount_point" >/dev/null 2>&1 || true
}
trap cleanup_mount EXIT
hdiutil attach -readonly -nobrowse -mountpoint "$mount_point" "$disk_image" >/dev/null
test -d "$mount_point/CodeWindow.app"
test -L "$mount_point/Applications"
test "$(readlink "$mount_point/Applications")" = "/Applications"
cmp "$mount_point/.DS_Store" Resources/DMG/.DS_Store
test ! -e "$mount_point/.background"
xcrun stapler validate "$mount_point/CodeWindow.app"
codesign --verify --deep --strict --verbose=2 "$mount_point/CodeWindow.app"
spctl --assess --type execute --verbose=4 "$mount_point/CodeWindow.app"
cleanup_mount
trap - EXIT
- name: Publish GitHub release
env:
GH_TOKEN: ${{ github.token }}
run: |
version=$(/usr/libexec/PlistBuddy -c 'Print :CFBundleShortVersionString' Resources/Info.plist)
gh release create "$GITHUB_REF_NAME" \
"build/CodeWindow-v${version}-macOS-universal.zip" \
"build/CodeWindow-v${version}-macOS-universal.zip.sha256" \
"build/CodeWindow-v${version}-macOS-universal.dmg" \
"build/CodeWindow-v${version}-macOS-universal.dmg.sha256" \
build/appcast.xml \
--verify-tag \
--title "CodeWindow $version" \
--generate-notes