-
-
Notifications
You must be signed in to change notification settings - Fork 369
181 lines (152 loc) · 5.4 KB
/
edge.yml
File metadata and controls
181 lines (152 loc) · 5.4 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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
name: Build & Release Edge
on:
push:
branches:
- "main"
env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Setup repo
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: "1.25.1"
- name: Install dependencies
run: npm ci
- name: Compile frontend and plug-compile
run: |
npm run build
npm run build:plug-compile
- name: Build Go binaries for multiple platforms
run: |
make build-server-releases
make build-cli-releases
- name: Upload macOS binaries for signing
uses: actions/upload-artifact@v5
with:
name: macos-unsigned
path: |
silverbullet-server-darwin-*.zip
silverbullet-cli-darwin-*.zip
retention-days: 1
- name: Remove macOS zips before uploading non-macOS binaries
run: rm -f silverbullet-*-darwin-*.zip
- name: Upload non-macOS binaries
uses: actions/upload-artifact@v5
with:
name: other-binaries
path: |
silverbullet-*.zip
silverbullet-cli-*.zip
website/CHANGELOG.md
dist/plug-compile.js
retention-days: 1
sign-macos:
needs: build
runs-on: macos-latest
steps:
- name: Download unsigned macOS binaries
uses: actions/download-artifact@v5
with:
name: macos-unsigned
- name: Import certificate into keychain
env:
APPLE_CERTIFICATE_P12_BASE64: ${{ secrets.APPLE_CERTIFICATE_P12_BASE64 }}
APPLE_CERTIFICATE_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }}
run: |
echo "$APPLE_CERTIFICATE_P12_BASE64" | base64 --decode > certificate.p12
KEYCHAIN_PATH="$RUNNER_TEMP/signing.keychain-db"
KEYCHAIN_PASSWORD="$(openssl rand -hex 20)"
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.p12 \
-P "$APPLE_CERTIFICATE_PASSWORD" \
-A \
-t cert \
-f pkcs12 \
-k "$KEYCHAIN_PATH"
security list-keychain -d user -s "$KEYCHAIN_PATH"
security set-key-partition-list -S apple-tool:,apple:,codesign: \
-s -k "$KEYCHAIN_PASSWORD" "$KEYCHAIN_PATH"
rm certificate.p12
- name: Sign and notarize macOS binaries
env:
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
APPLE_API_KEY_ID: ${{ secrets.APPLE_API_KEY_ID }}
APPLE_API_KEY_ISSUER_ID: ${{ secrets.APPLE_API_KEY_ISSUER_ID }}
APPLE_API_KEY_P8_BASE64: ${{ secrets.APPLE_API_KEY_P8_BASE64 }}
run: |
mkdir -p ~/private_keys
echo "$APPLE_API_KEY_P8_BASE64" | base64 --decode \
> ~/private_keys/AuthKey_${APPLE_API_KEY_ID}.p8
IDENTITY="Developer ID Application: Zef Hemel ($APPLE_TEAM_ID)"
for zip_file in silverbullet-*-darwin-*.zip; do
echo "=== Processing $zip_file ==="
zip_file="$(pwd)/$zip_file"
WORK_DIR=$(mktemp -d)
unzip -o "$zip_file" -d "$WORK_DIR"
BINARY=$(ls "$WORK_DIR")
codesign --force --options runtime \
--sign "$IDENTITY" \
--timestamp \
"$WORK_DIR/$BINARY"
codesign --verify --verbose "$WORK_DIR/$BINARY"
NOTARIZE_ZIP="$WORK_DIR/notarize.zip"
ditto -c -k --keepParent "$WORK_DIR/$BINARY" "$NOTARIZE_ZIP"
xcrun notarytool submit "$NOTARIZE_ZIP" \
--key ~/private_keys/AuthKey_${APPLE_API_KEY_ID}.p8 \
--key-id "$APPLE_API_KEY_ID" \
--issuer "$APPLE_API_KEY_ISSUER_ID" \
--wait --timeout 10m
rm "$zip_file"
(cd "$WORK_DIR" && zip "$zip_file" "$BINARY")
rm -rf "$WORK_DIR"
done
rm -rf ~/private_keys
- name: Upload signed macOS binaries
uses: actions/upload-artifact@v5
with:
name: macos-signed
path: |
silverbullet-*-darwin-*.zip
- name: Clean up keychain
if: always()
run: |
security delete-keychain "$RUNNER_TEMP/signing.keychain-db" 2>/dev/null || true
release:
needs: [build, sign-macos]
runs-on: ubuntu-latest
steps:
- name: Download signed macOS binaries
uses: actions/download-artifact@v5
with:
name: macos-signed
path: release
- name: Download other binaries
uses: actions/download-artifact@v5
with:
name: other-binaries
path: release
- name: Update edge release
uses: softprops/action-gh-release@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
draft: false
tag_name: edge
body: Automated build from commit ${{ github.sha }}
prerelease: true
files: |
release/website/CHANGELOG.md
release/dist/plug-compile.js
release/silverbullet-*.zip
release/silverbullet-cli-*.zip