-
Notifications
You must be signed in to change notification settings - Fork 1
361 lines (329 loc) · 12.1 KB
/
release.yml
File metadata and controls
361 lines (329 loc) · 12.1 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
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
name: Release
on:
push:
tags: [v*]
workflow_dispatch:
inputs:
dry-run:
description: 'Run full pipeline without publishing'
type: boolean
default: true
permissions:
contents: write
pages: write
id-token: write
packages: write
jobs:
build-jar:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with: { distribution: temurin, java-version: 21 }
- uses: DeLaGuardo/setup-clojure@13.0
with: { cli: latest }
- run: clojure -T:build uber
- uses: actions/upload-artifact@v4
with:
name: noumenon-jar
path: target/noumenon-*.jar
build-launcher:
strategy:
fail-fast: false
matrix:
include:
- runner: ubuntu-latest
os: linux
arch: amd64
bb-arch: linux-amd64-static
binary: noum-linux-x86_64
- runner: ubuntu-24.04-arm
os: linux
arch: arm64
bb-arch: linux-aarch64-static
binary: noum-linux-arm64
- runner: macos-latest
os: macos
arch: arm64
bb-arch: macos-aarch64
binary: noum-macos-arm64
- runner: windows-latest
os: windows
arch: x86_64
bb-arch: windows-amd64
binary: noum-windows-x86_64.exe
runs-on: ${{ matrix.runner }}
steps:
- uses: actions/checkout@v4
- name: Download Babashka
shell: bash
run: |
BB_VERSION="1.12.217"
if [ "${{ matrix.os }}" = "windows" ]; then
curl -sL "https://github.com/babashka/babashka/releases/download/v${BB_VERSION}/babashka-${BB_VERSION}-${{ matrix.bb-arch }}.zip" -o bb.zip
unzip bb.zip
else
curl -sL "https://github.com/babashka/babashka/releases/download/v${BB_VERSION}/babashka-${BB_VERSION}-${{ matrix.bb-arch }}.tar.gz" | tar xz
fi
- name: Copy shared version into launcher resources
shell: bash
run: cp resources/version.edn launcher/resources/version.edn
- name: Build launcher uberjar
shell: bash
working-directory: launcher
run: |
if [ "${{ matrix.os }}" = "windows" ]; then
../bb.exe uberjar target/noum.jar -m noum.main --classpath "src;resources"
else
../bb uberjar target/noum.jar -m noum.main --classpath src:resources
fi
- name: Create self-contained binary
shell: bash
run: |
if [ "${{ matrix.os }}" = "windows" ]; then
cat bb.exe launcher/target/noum.jar > ${{ matrix.binary }}
else
cat bb launcher/target/noum.jar > ${{ matrix.binary }}
chmod +x ${{ matrix.binary }}
fi
- name: Smoke test
if: matrix.os != 'windows'
shell: bash
run: ./${{ matrix.binary }} version
- uses: actions/upload-artifact@v4
with:
name: ${{ matrix.binary }}
path: ${{ matrix.binary }}
integration-test:
needs: build-launcher
strategy:
matrix:
include:
- runner: ubuntu-latest
binary: noum-linux-x86_64
- runner: macos-latest
binary: noum-macos-arm64
runs-on: ${{ matrix.runner }}
steps:
- uses: actions/download-artifact@v4
with:
name: ${{ matrix.binary }}
- name: Make executable
if: matrix.runner != 'windows-latest'
run: chmod +x ${{ matrix.binary }}
- name: Test version
run: ./${{ matrix.binary }} version
- name: Test help
run: ./${{ matrix.binary }} help
- name: Test ping (daemon not running)
run: ./${{ matrix.binary }} ping || true
# --- Publishing jobs (skipped for dry-run and rc tags where noted) ---
release:
if: ${{ !inputs.dry-run }}
needs: [build-jar, build-launcher, integration-test]
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v4
with:
path: artifacts
- name: List artifacts
run: find artifacts -type f
- name: Generate SHA256 sidecar files
run: |
for bin in noum-macos-arm64 noum-linux-x86_64 noum-linux-arm64; do
if [ -f "artifacts/${bin}/${bin}" ]; then
sha256sum "artifacts/${bin}/${bin}" | cut -d' ' -f1 > "artifacts/${bin}/${bin}.sha256"
fi
done
if [ -f "artifacts/noum-windows-x86_64.exe/noum-windows-x86_64.exe" ]; then
sha256sum "artifacts/noum-windows-x86_64.exe/noum-windows-x86_64.exe" | cut -d' ' -f1 > "artifacts/noum-windows-x86_64.exe/noum-windows-x86_64.exe.sha256"
fi
- uses: softprops/action-gh-release@v2
with:
files: |
artifacts/noumenon-jar/noumenon-*.jar
artifacts/noum-macos-arm64/noum-macos-arm64
artifacts/noum-macos-arm64/noum-macos-arm64.sha256
artifacts/noum-linux-x86_64/noum-linux-x86_64
artifacts/noum-linux-x86_64/noum-linux-x86_64.sha256
artifacts/noum-linux-arm64/noum-linux-arm64
artifacts/noum-linux-arm64/noum-linux-arm64.sha256
artifacts/noum-windows-x86_64.exe/noum-windows-x86_64.exe
artifacts/noum-windows-x86_64.exe/noum-windows-x86_64.exe.sha256
generate_release_notes: true
prerelease: ${{ contains(github.ref_name, '-rc') }}
draft: ${{ contains(github.ref_name, '-rc') }}
docker:
if: ${{ !inputs.dry-run }}
needs: [build-jar, integration-test]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: docker/metadata-action@v5
id: meta
with:
images: ghcr.io/leifericf/noumenon
tags: |
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=raw,value=latest,enable=${{ !contains(github.ref_name, '-rc') }}
- uses: docker/build-push-action@v6
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
update-homebrew:
if: ${{ !inputs.dry-run && !contains(github.ref_name, '-rc') }}
needs: release
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v4
with:
path: artifacts
- name: Compute SHA256 hashes
id: hashes
run: |
echo "macos_arm64=$(sha256sum artifacts/noum-macos-arm64/noum-macos-arm64 | cut -d' ' -f1)" >> "$GITHUB_OUTPUT"
echo "linux_arm64=$(sha256sum artifacts/noum-linux-arm64/noum-linux-arm64 | cut -d' ' -f1)" >> "$GITHUB_OUTPUT"
echo "linux_x86_64=$(sha256sum artifacts/noum-linux-x86_64/noum-linux-x86_64 | cut -d' ' -f1)" >> "$GITHUB_OUTPUT"
- name: Update Homebrew formula
env:
GH_TOKEN: ${{ secrets.TAP_TOKEN }}
run: |
VERSION="${GITHUB_REF_NAME#v}"
if ! [[ "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9.]+)?$ ]]; then
echo "::error::Invalid version format: $VERSION"
exit 1
fi
git clone https://x-access-token:${GH_TOKEN}@github.com/leifericf/homebrew-noumenon.git tap
cd tap
cat > Formula/noumenon.rb << 'FORMULA'
class Noumenon < Formula
desc "Datomic knowledge graph for codebase understanding"
homepage "https://noumenon.leifericf.com"
license "MIT"
version "VERSION_PLACEHOLDER"
on_macos do
url "https://github.com/leifericf/noumenon/releases/download/vVERSION_PLACEHOLDER/noum-macos-arm64"
sha256 "SHA_MACOS_ARM64"
end
on_linux do
if Hardware::CPU.arm?
url "https://github.com/leifericf/noumenon/releases/download/vVERSION_PLACEHOLDER/noum-linux-arm64"
sha256 "SHA_LINUX_ARM64"
else
url "https://github.com/leifericf/noumenon/releases/download/vVERSION_PLACEHOLDER/noum-linux-x86_64"
sha256 "SHA_LINUX_X86_64"
end
end
def install
binary = Dir["noum-*"].first
bin.install binary => "noum"
end
test do
assert_match "noum", shell_output("#{bin}/noum version")
end
end
FORMULA
sed -i "s/VERSION_PLACEHOLDER/${VERSION}/g" Formula/noumenon.rb
sed -i "s/SHA_MACOS_ARM64/${{ steps.hashes.outputs.macos_arm64 }}/g" Formula/noumenon.rb
sed -i "s/SHA_LINUX_ARM64/${{ steps.hashes.outputs.linux_arm64 }}/g" Formula/noumenon.rb
sed -i "s/SHA_LINUX_X86_64/${{ steps.hashes.outputs.linux_x86_64 }}/g" Formula/noumenon.rb
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add Formula/noumenon.rb
git commit -m "Update to v${VERSION}"
git push
update-scoop:
if: ${{ !inputs.dry-run && !contains(github.ref_name, '-rc') }}
needs: release
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v4
with:
name: noum-windows-x86_64.exe
- name: Compute SHA256
id: hash
run: echo "windows=$(sha256sum noum-windows-x86_64.exe | cut -d' ' -f1)" >> "$GITHUB_OUTPUT"
- name: Update Scoop manifest
env:
GH_TOKEN: ${{ secrets.TAP_TOKEN }}
run: |
VERSION="${GITHUB_REF_NAME#v}"
git clone https://x-access-token:${GH_TOKEN}@github.com/leifericf/scoop-noumenon.git bucket
cd bucket
cat > bucket/noumenon.json << EOF
{
"version": "${VERSION}",
"description": "Datomic knowledge graph for codebase understanding",
"homepage": "https://noumenon.leifericf.com",
"license": "MIT",
"architecture": {
"64bit": {
"url": "https://github.com/leifericf/noumenon/releases/download/v${VERSION}/noum-windows-x86_64.exe",
"hash": "${{ steps.hash.outputs.windows }}"
}
},
"bin": [["noum-windows-x86_64.exe", "noum"]],
"checkver": {"github": "https://github.com/leifericf/noumenon"},
"autoupdate": {
"architecture": {
"64bit": {
"url": "https://github.com/leifericf/noumenon/releases/download/v\$version/noum-windows-x86_64.exe"
}
}
}
}
EOF
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add bucket/noumenon.json
git commit -m "Update to v${VERSION}"
git push
build-electron:
if: ${{ !inputs.dry-run }}
needs: release
strategy:
matrix:
os: [macos-latest, ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with: { distribution: temurin, java-version: 21 }
- uses: DeLaGuardo/setup-clojure@13.0
with: { cli: latest }
- uses: actions/setup-node@v4
with: { node-version: 22 }
- name: Install dependencies
working-directory: ui
run: npm ci
- name: Build ClojureScript
working-directory: ui
run: npx shadow-cljs release app
- name: Package Electron app
working-directory: ui
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: npx electron-builder build --publish always
deploy-pages:
if: ${{ !inputs.dry-run && !contains(github.ref_name, '-rc') }}
needs: release
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deploy.outputs.page_url }}
steps:
- uses: actions/checkout@v4
- uses: actions/configure-pages@v5
- uses: actions/upload-pages-artifact@v3
with:
path: docs
- id: deploy
uses: actions/deploy-pages@v4