-
Notifications
You must be signed in to change notification settings - Fork 4
455 lines (381 loc) · 13.3 KB
/
Copy pathrelease.yaml
File metadata and controls
455 lines (381 loc) · 13.3 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
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
name: release
permissions:
contents: read
on:
push:
tags:
- "v*.*.*"
jobs:
build:
name: Build
runs-on: ubuntu-24.04
strategy:
matrix:
arch: [amd64, arm64]
os: [linux, darwin, windows]
steps:
- name: Check out code
uses: actions/checkout@v4
- name: GitHub vars
uses: rlespinasse/github-slug-action@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: "${{env.GO_VERSION}}"
id: go
- name: Build
env:
GOARCH: ${{matrix.arch}}
GOOS: ${{matrix.os}}
run: make build-cli
- name: Tarball
if: ${{ matrix.os != 'windows' }}
run: |
cd bin
tar -czvf cordium-${{matrix.os}}-${{matrix.arch}}.tar.gz cordium
- name: Generate checksums (Unix)
if: ${{ matrix.os != 'windows' }}
run: |
cd bin
sha256sum *.tar.gz > checksums-${{matrix.os}}-${{matrix.arch}}.txt
- name: Save artifacts
if: ${{ matrix.os != 'windows' }}
uses: actions/upload-artifact@v4
with:
name: release-artifact-${{matrix.os}}-${{matrix.arch}}-${{ env.GITHUB_REF_SLUG }}
path: |
bin/*.tar.gz
bin/checksums-${{matrix.os}}-${{matrix.arch}}.txt
retention-days: 1
- name: Zip for Windows
if: ${{ matrix.os == 'windows' }}
run: |
cd bin
zip cordium-${{matrix.os}}-${{matrix.arch}}.zip cordium.exe
- name: Generate checksums (Windows)
if: ${{ matrix.os == 'windows' }}
run: |
cd bin
sha256sum *.zip > checksums-${{matrix.os}}-${{matrix.arch}}.txt
- name: Save Windows artifacts
if: ${{ matrix.os == 'windows' }}
uses: actions/upload-artifact@v4
with:
name: release-artifact-${{matrix.os}}-${{matrix.arch}}-${{ env.GITHUB_REF_SLUG }}
path: |
bin/*.zip
bin/checksums-${{matrix.os}}-${{matrix.arch}}.txt
retention-days: 1
- name: Save Windows binaries for MSI
if: ${{ matrix.os == 'windows' }}
uses: actions/upload-artifact@v4
with:
name: windows-binaries-${{matrix.arch}}-${{ env.GITHUB_REF_SLUG }}
path: bin/*.exe
retention-days: 1
package-linux:
name: Package Linux
runs-on: ubuntu-24.04
needs: build
strategy:
matrix:
arch: [amd64, arm64]
steps:
- name: Check out code
uses: actions/checkout@v4
- name: GitHub vars
uses: rlespinasse/github-slug-action@v4
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: release-artifact-linux-${{matrix.arch}}-${{ env.GITHUB_REF_SLUG }}
path: artifacts
- name: Extract binaries
run: |
mkdir -p bin
cd artifacts
tar -xzf cordium-linux-${{matrix.arch}}.tar.gz -C ../bin
cd ..
chmod +x bin/*
- name: Install packaging tools
run: |
sudo apt-get update
sudo apt-get install -y rpm
- name: Get version
id: version
run: |
VERSION=${GITHUB_REF#refs/tags/v}
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "release=1" >> $GITHUB_OUTPUT
- name: Create DEB packages
env:
VERSION: ${{ steps.version.outputs.version }}
RELEASE: ${{ steps.version.outputs.release }}
ARCH: ${{ matrix.arch }}
run: |
DEB_ARCH=$ARCH
if [ "$ARCH" = "amd64" ]; then
DEB_ARCH="amd64"
elif [ "$ARCH" = "arm64" ]; then
DEB_ARCH="arm64"
fi
create_deb() {
local PKG_NAME=$1
local PKG_DIR="packaging/deb/${PKG_NAME}_${VERSION}-${RELEASE}_${DEB_ARCH}"
mkdir -p ${PKG_DIR}/usr/bin
mkdir -p ${PKG_DIR}/usr/share/doc/${PKG_NAME}
mkdir -p ${PKG_DIR}/DEBIAN
cp bin/${PKG_NAME} ${PKG_DIR}/usr/bin/
cp LICENSE ${PKG_DIR}/usr/share/doc/${PKG_NAME}/copyright
cat > ${PKG_DIR}/DEBIAN/control <<EOF
Package: ${PKG_NAME}
Version: ${VERSION}-${RELEASE}
Section: net
Priority: optional
Architecture: ${DEB_ARCH}
Maintainer: George Badawi <contact@octelium.com>
Description: ${PKG_NAME} - A modern, free and open source, identity-based sandbox platform for humans and AI agents.
Homepage: https://octelium.com
License: Apache-2.0
EOF
dpkg-deb --build ${PKG_DIR}
mv ${PKG_DIR}.deb packaging/
}
mkdir -p packaging/deb
create_deb "cordium"
- name: Create RPM packages
env:
VERSION: ${{ steps.version.outputs.version }}
RELEASE: ${{ steps.version.outputs.release }}
ARCH: ${{ matrix.arch }}
run: |
RPM_ARCH=$ARCH
if [ "$ARCH" = "amd64" ]; then
RPM_ARCH="x86_64"
elif [ "$ARCH" = "arm64" ]; then
RPM_ARCH="aarch64"
fi
create_rpm() {
local PKG_NAME=$1
local BASE_DIR="packaging/rpm/build/${PKG_NAME}"
mkdir -p ${BASE_DIR}/{BUILD,RPMS,SOURCES,SPECS,SRPMS}
cp bin/${PKG_NAME} ${BASE_DIR}/SOURCES/
cp LICENSE ${BASE_DIR}/SOURCES/LICENSE
cat > ${BASE_DIR}/SPECS/${PKG_NAME}.spec <<EOF
Name: ${PKG_NAME}
Version: ${VERSION}
Release: ${RELEASE}%{?dist}
Summary: ${PKG_NAME} - A modern, open source, identity-based sandbox platform for humans and AI agents
License: Apache-2.0
URL: https://octelium.com
Source0: ${PKG_NAME}
Source1: LICENSE
%define debug_package %{nil}
%define __strip /bin/true
%description
A modern, free and open source, identity-based sandbox platform for humans and AI agents.
%install
mkdir -p %{buildroot}/usr/bin
mkdir -p %{buildroot}/usr/share/licenses/${PKG_NAME}
install -m 755 %{_sourcedir}/${PKG_NAME} %{buildroot}/usr/bin/${PKG_NAME}
install -m 644 %{_sourcedir}/LICENSE %{buildroot}/usr/share/licenses/${PKG_NAME}/LICENSE
%files
%license /usr/share/licenses/${PKG_NAME}/LICENSE
%dir /usr/share/licenses/${PKG_NAME}
/usr/bin/${PKG_NAME}
%changelog
* $(date '+%a %b %d %Y') George Badawi <contact@octelium.com> - ${VERSION}-${RELEASE}
- Release ${VERSION}-${RELEASE}
EOF
rpmbuild --target ${RPM_ARCH} \
--define "_topdir $(pwd)/${BASE_DIR}" \
--define "_rpmdir $(pwd)/packaging/rpm" \
-bb ${BASE_DIR}/SPECS/${PKG_NAME}.spec
}
mkdir -p packaging/rpm
create_rpm "cordium"
# Move RPMs to flat structure
find packaging/rpm -type f -name "*.rpm" -exec mv {} packaging/ \;
- name: List created packages
run: |
echo "Contents of packaging directory:"
ls -la packaging/
- name: Upload DEB/RPM artifacts
uses: actions/upload-artifact@v4
with:
name: packages-linux-${{matrix.arch}}-${{ env.GITHUB_REF_SLUG }}
path: |
packaging/*.deb
packaging/*.rpm
retention-days: 1
package-windows:
name: Package Windows
runs-on: windows-2022
needs: build
strategy:
matrix:
arch: [amd64, arm64]
steps:
- name: Check out code
uses: actions/checkout@v4
- name: GitHub vars
uses: rlespinasse/github-slug-action@v4
- name: Download binaries
uses: actions/download-artifact@v4
with:
name: windows-binaries-${{matrix.arch}}-${{ env.GITHUB_REF_SLUG }}
path: bin
- name: Get version
id: version
shell: bash
run: |
VERSION=${GITHUB_REF#refs/tags/v}
echo "version=$VERSION" >> $GITHUB_OUTPUT
- name: Install WiX Toolset
run: |
dotnet tool install --global wix --version 5.0.2
wix --version
- name: Create MSI for cordium
shell: pwsh
env:
VERSION: ${{ steps.version.outputs.version }}
ARCH: ${{ matrix.arch }}
run: |
.github/scripts/windows/build-msi.ps1 `
-Version $env:VERSION `
-Arch $env:ARCH
- name: List created packages
run: |
Write-Host "Contents of packaging directory:"
Get-ChildItem -Path packaging -Recurse
- name: Upload MSI artifacts
uses: actions/upload-artifact@v4
with:
name: packages-windows-${{matrix.arch}}-${{ env.GITHUB_REF_SLUG }}
path: packaging/*.msi
retention-days: 1
package-macos:
name: Package macOS
runs-on: macos-14
needs: build
strategy:
matrix:
arch: [amd64, arm64]
steps:
- name: Check out code
uses: actions/checkout@v4
- name: GitHub vars
uses: rlespinasse/github-slug-action@v4
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: release-artifact-darwin-${{matrix.arch}}-${{ env.GITHUB_REF_SLUG }}
path: artifacts
- name: Extract binaries
run: |
mkdir -p bin
cd artifacts
tar -xzf cordium-darwin-${{matrix.arch}}.tar.gz -C ../bin
cd ..
chmod +x bin/*
- name: Make build script executable
run: chmod +x .github/scripts/macos/build-pkg.sh
- name: Get version
id: version
run: |
VERSION=${GITHUB_REF#refs/tags/v}
echo "version=$VERSION" >> $GITHUB_OUTPUT
- name: Create PKG for cordium
env:
VERSION: ${{ steps.version.outputs.version }}
ARCH: ${{ matrix.arch }}
run: |
.github/scripts/macos/build-pkg.sh \
--package-name cordium \
--version $VERSION \
--arch $ARCH
- name: List created packages
run: |
echo "Contents of packaging directory:"
ls -la packaging/
- name: Upload PKG artifacts
uses: actions/upload-artifact@v4
with:
name: packages-macos-${{matrix.arch}}-${{ env.GITHUB_REF_SLUG }}
path: packaging/*.pkg
retention-days: 1
release:
name: Release
runs-on: ubuntu-24.04
needs: [build, package-linux, package-macos, package-windows]
permissions:
contents: write
steps:
- name: Check out code
uses: actions/checkout@v4
- name: GitHub vars
uses: rlespinasse/github-slug-action@v4
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
pattern: release-artifact-*
path: artifacts
- name: Download Linux packages
uses: actions/download-artifact@v4
with:
pattern: packages-linux-*
path: artifacts
- name: Download macOS packages
uses: actions/download-artifact@v4
with:
pattern: packages-macos-*
path: artifacts
- name: Download Windows packages
uses: actions/download-artifact@v4
with:
pattern: packages-windows-*
path: artifacts
- name: Organize files for release
run: |
mkdir -p release-files
# Copy all release artifacts (tarballs and zips)
find artifacts -type f \( -name "*.tar.gz" -o -name "*.zip" \) -exec cp {} release-files/ \;
# Copy all package files (avoiding duplicates by using -n flag)
find artifacts -type f -name "*.deb" -exec cp -n {} release-files/ \;
find artifacts -type f -name "*.rpm" -exec cp -n {} release-files/ \;
find artifacts -type f -name "*.pkg" -exec cp -n {} release-files/ \;
find artifacts -type f -name "*.msi" -exec cp -n {} release-files/ \;
echo "=== Files prepared for release ==="
ls -lh release-files/ | wc -l
echo "files ready"
- name: Generate checksums
run: |
cd release-files
sha256sum * > ../SHA256SUMS
cd ..
echo "=== SHA256SUMS content ==="
cat SHA256SUMS
# Move SHA256SUMS to release-files
mv SHA256SUMS release-files/
- name: Generate and Download SBOM from GitHub
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
echo "Fetching SBOM from GitHub Dependency Graph API..."
gh api \
-H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" \
/repos/${{ github.repository }}/dependency-graph/sbom | jq -r '.sbom' > sbom.json
mv sbom.json release-files/
- name: Verify release files
run: |
echo "=== Final release file count ==="
ls -1 release-files/ | wc -l
echo ""
echo "=== Release files ==="
ls -lh release-files/
- name: Release
uses: softprops/action-gh-release@v2
with:
files: release-files/*
fail_on_unmatched_files: true