-
Notifications
You must be signed in to change notification settings - Fork 129
295 lines (255 loc) · 9.62 KB
/
Copy pathrelease.yml
File metadata and controls
295 lines (255 loc) · 9.62 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
name: Release
on:
push:
tags: ["v*"]
env:
CARGO_TERM_COLOR: always
RIPGREP_VERSION: 15.1.0
jobs:
# ── Matrix build ─────────────────────────────────────────────────────────
build:
name: Build ${{ matrix.target }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-musl
ext: ""
archive: tar.gz
- os: ubuntu-latest
target: aarch64-unknown-linux-musl
ext: ""
archive: tar.gz
- os: macos-latest
target: aarch64-apple-darwin
ext: ""
archive: tar.gz
- os: macos-latest
target: x86_64-apple-darwin
ext: ""
archive: tar.gz
- os: windows-latest
target: x86_64-pc-windows-msvc
ext: ".exe"
archive: zip
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- uses: Swatinem/rust-cache@v2
with:
key: release-${{ matrix.target }}
- uses: mlugg/setup-zig@v2
if: runner.os == 'Linux'
- name: Install cargo-zigbuild
uses: taiki-e/install-action@v2
if: runner.os == 'Linux'
with:
tool: cargo-zigbuild@0.22.3
- name: Build release binary (x86_64 Linux)
if: matrix.target == 'x86_64-unknown-linux-musl'
run: cargo zigbuild --release --target ${{ matrix.target }} -p devo-cli
- name: Build release binary (Linux ARM64)
if: matrix.target == 'aarch64-unknown-linux-musl'
run: cargo zigbuild --release --target ${{ matrix.target }} -p devo-cli
- name: Build release binary (macOS)
if: runner.os == 'macOS'
run: cargo build --release --target ${{ matrix.target }} -p devo-cli
- name: Build release binary (Windows)
if: runner.os == 'Windows'
run: cargo build --release --target ${{ matrix.target }} -p devo-cli
- name: Strip symbols (macOS)
if: runner.os == 'macOS'
run: strip target/${{ matrix.target }}/release/devo${{ matrix.ext }}
- name: Prepare staging directory
shell: bash
run: |
staging=devo-${{ github.ref_name }}-${{ matrix.target }}
mkdir -p "$staging"
cp target/${{ matrix.target }}/release/devo${{ matrix.ext }} "$staging/"
cp README.md LICENSE "$staging/" 2>/dev/null || true
echo "STAGING=$staging" >> "$GITHUB_ENV"
- name: Create tar.gz archive (Linux/macOS)
if: runner.os != 'Windows'
run: tar czf "${{ env.STAGING }}.tar.gz" "${{ env.STAGING }}"
- name: Create zip archive (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
$staging = "$env:STAGING"
Compress-Archive -Path "$staging/*" -DestinationPath "$staging.zip"
- uses: actions/upload-artifact@v4
with:
name: devo-${{ github.ref_name }}-${{ matrix.target }}
path: devo-${{ github.ref_name }}-${{ matrix.target }}.*
# ── Desktop app builds ───────────────────────────────────────────────────
desktop:
name: Build desktop ${{ matrix.platform }} ${{ matrix.arch }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: macos-latest
platform: mac
arch: arm64
target: aarch64-apple-darwin
rg_target: aarch64-apple-darwin
script: package:mac:arm64
- os: macos-latest
platform: mac
arch: x64
target: x86_64-apple-darwin
rg_target: x86_64-apple-darwin
script: package:mac:x64
- os: windows-latest
platform: windows
arch: x64
target: x86_64-pc-windows-msvc
rg_target: x86_64-pc-windows-msvc
script: package:win:x64
- os: windows-latest
platform: windows
arch: arm64
target: aarch64-pc-windows-msvc
rg_target: aarch64-pc-windows-msvc
script: package:win:arm64
- os: ubuntu-latest
platform: linux
arch: x64
target: x86_64-unknown-linux-musl
rg_target: x86_64-unknown-linux-musl
script: package:linux:x64
- os: ubuntu-latest
platform: linux
arch: arm64
target: aarch64-unknown-linux-musl
rg_target: aarch64-unknown-linux-gnu
script: package:linux:arm64
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- uses: Swatinem/rust-cache@v2
with:
key: desktop-${{ matrix.target }}
- uses: mlugg/setup-zig@v2
if: runner.os == 'Linux'
- name: Install cargo-zigbuild
uses: taiki-e/install-action@v2
if: runner.os == 'Linux'
with:
tool: cargo-zigbuild@0.22.3
- uses: oven-sh/setup-bun@v2
- name: Install Linux packaging dependencies
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y rpm
- name: Download ripgrep sidecar (Linux/macOS)
if: runner.os != 'Windows'
shell: bash
run: |
set -euo pipefail
archive="ripgrep-${RIPGREP_VERSION}-${{ matrix.rg_target }}.tar.gz"
tmp_dir="$(mktemp -d)"
curl -fsSL "https://github.com/BurntSushi/ripgrep/releases/download/${RIPGREP_VERSION}/${archive}" -o "${tmp_dir}/${archive}"
tar -xzf "${tmp_dir}/${archive}" -C "$tmp_dir"
rg_bin="$(find "$tmp_dir" -type f -name rg | sed -n '1p')"
if [ -z "$rg_bin" ]; then
echo "rg not found in ${archive}" >&2
exit 1
fi
chmod +x "$rg_bin"
file "$rg_bin" || true
echo "DEVO_DESKTOP_RUNTIME_RG_BIN=$rg_bin" >> "$GITHUB_ENV"
- name: Download ripgrep sidecar (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
$rgVersion = $env:RIPGREP_VERSION
if ([string]::IsNullOrWhiteSpace($rgVersion)) {
throw "RIPGREP_VERSION must be set"
}
$archive = "ripgrep-$rgVersion-${{ matrix.rg_target }}.zip"
$tmpDir = Join-Path $env:RUNNER_TEMP "ripgrep"
New-Item -ItemType Directory -Force -Path $tmpDir | Out-Null
$archivePath = Join-Path $tmpDir $archive
Invoke-WebRequest -Uri "https://github.com/BurntSushi/ripgrep/releases/download/$rgVersion/$archive" -OutFile $archivePath
Expand-Archive -Path $archivePath -DestinationPath $tmpDir -Force
$rg = Get-ChildItem -Recurse -Filter "rg.exe" -Path $tmpDir | Select-Object -First 1
if (-not $rg) {
throw "rg.exe not found in $archive"
}
Get-Item $rg.FullName | Select-Object FullName, Length
"DEVO_DESKTOP_RUNTIME_RG_BIN=$($rg.FullName)" | Out-File -FilePath $env:GITHUB_ENV -Append
- name: Install desktop dependencies
working-directory: apps/desktop
run: bun install --frozen-lockfile
- name: Build desktop package
working-directory: apps/desktop
run: bun run ${{ matrix.script }}
env:
CSC_IDENTITY_AUTO_DISCOVERY: false
- uses: actions/upload-artifact@v4
with:
name: devo-desktop-${{ github.ref_name }}-${{ matrix.platform }}-${{ matrix.arch }}
path: |
apps/desktop/release/*.AppImage
apps/desktop/release/*.blockmap
apps/desktop/release/*.deb
apps/desktop/release/*.dmg
apps/desktop/release/*.exe
apps/desktop/release/*.rpm
apps/desktop/release/*.yml
apps/desktop/release/*.zip
# ── Create GitHub Release ──────────────────────────────────────────────
release:
name: Create Release
needs: [build, desktop]
runs-on: ubuntu-24.04
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
merge-multiple: true
path: artifacts
- name: Collect individual release assets
run: |
mkdir -p release-assets
find artifacts -maxdepth 1 -type f \
\( -name '*.AppImage' \
-o -name '*.deb' \
-o -name '*.dmg' \
-o -name '*.exe' \
-o -name '*.rpm' \
-o -name '*.tar.gz' \
-o -name '*.zip' \) \
-exec cp {} release-assets/ \;
find release-assets -maxdepth 1 -type f -print | sort
- name: Generate release notes
run: |
cat > release-notes.md <<'NOTES'
## Install
### Linux / macOS
```bash
curl -fsSL https://raw.githubusercontent.com/7df-lab/devo/main/install.sh | sh
```
### Windows
```powershell
irm 'https://raw.githubusercontent.com/7df-lab/devo/main/install.ps1' | iex
```
---
NOTES
- name: Create release
uses: softprops/action-gh-release@v2
with:
body_path: release-notes.md
draft: true
files: release-assets/*
generate_release_notes: true