-
Notifications
You must be signed in to change notification settings - Fork 772
172 lines (143 loc) · 4.67 KB
/
Copy pathdev-release.yml
File metadata and controls
172 lines (143 loc) · 4.67 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
name: Dev Release (main)
on:
push:
branches: [main]
concurrency:
group: dev-release-${{ github.ref }}
cancel-in-progress: true
jobs:
verify:
runs-on: ubuntu-latest
env:
KODE_SKIP_BINARY_DOWNLOAD: '1'
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.sha }}
- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: '1.3.14'
- name: Install
run: bun install --frozen-lockfile
- name: Dependency audit
run: bun run security:audit
- name: Format
run: bun run format:check
- name: Lint
run: bun run lint
- name: Typecheck
run: bun run typecheck
- name: Test
run: bun run test
compute-version:
runs-on: ubuntu-latest
outputs:
dev_version: ${{ steps.version.outputs.dev_version }}
tag_name: ${{ steps.version.outputs.tag_name }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.sha }}
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20.19.0'
- name: Compute dev version
id: version
run: |
BASE_VERSION=$(node -p "require('./package.json').version")
DEV_VERSION="${BASE_VERSION}-dev.${{ github.run_number }}"
echo "dev_version=${DEV_VERSION}" >> "${GITHUB_OUTPUT}"
echo "tag_name=v${DEV_VERSION}" >> "${GITHUB_OUTPUT}"
echo "Dev version: ${DEV_VERSION}"
build-binaries:
needs: [verify, compute-version]
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
- os: macos-latest
- os: windows-latest
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.sha }}
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20.19.0'
- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: '1.3.14'
- name: Install
run: bun install --frozen-lockfile
- name: Build Linux seccomp assets (Unix socket blocking)
if: runner.os == 'Linux'
run: node scripts/build-seccomp-assets.mjs --require --verbose
- name: Stage seccomp assets for publishing
if: runner.os == 'Linux'
run: |
set -euo pipefail
ARCH="$(node -p 'process.arch')"
mkdir -p "seccomp-assets/linux-${ARCH}"
cp "vendor/seccomp/${ARCH}/apply-seccomp" "seccomp-assets/linux-${ARCH}/apply-seccomp"
cp "vendor/seccomp/${ARCH}/unix-block.bpf" "seccomp-assets/linux-${ARCH}/unix-block.bpf"
chmod 755 "seccomp-assets/linux-${ARCH}/apply-seccomp" || true
- name: Upload seccomp assets artifact
if: runner.os == 'Linux'
uses: actions/upload-artifact@v4
with:
name: seccomp-linux-${{ matrix.os }}
path: seccomp-assets/**
if-no-files-found: error
- name: Set package.json version (dev)
run: node scripts/set-root-package-version.mjs
env:
DEV_VERSION: ${{ needs.compute-version.outputs.dev_version }}
- name: Build (assets needed for standalone binary)
run: bun run build
- name: Ensure bundled ripgrep (current platform only)
run: bun run scripts/ensure-ripgrep.mjs --current-only
- name: Build binary
run: bun run build:binary
- name: Prepare release asset
id: asset
run: node scripts/prepare-release-asset.mjs
- name: Upload binary artifact
uses: actions/upload-artifact@v4
with:
name: ${{ steps.asset.outputs.asset }}
path: ${{ steps.asset.outputs.asset }}
if-no-files-found: error
prerelease:
needs: [compute-version, build-binaries]
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Download binary artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Create checksums
run: |
find artifacts -type f -maxdepth 2 -print0 | sort -z | xargs -0 shasum -a 256 > checksums-sha256.txt
echo "Checksums:"
head -n 20 checksums-sha256.txt
- name: Create GitHub prerelease
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ needs.compute-version.outputs.tag_name }}
name: ${{ needs.compute-version.outputs.tag_name }}
prerelease: true
files: |
artifacts/**/*
checksums-sha256.txt