-
-
Notifications
You must be signed in to change notification settings - Fork 0
319 lines (266 loc) · 9.25 KB
/
ci.yml
File metadata and controls
319 lines (266 loc) · 9.25 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
name: CI
on:
push:
branches:
- '**'
tags:
- 'v*'
pull_request:
jobs:
build-and-test:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
toolchain: "1.94"
components: clippy
- name: Lint (clippy)
run: cargo clippy -- -D warnings
- name: Build
run: cargo build --verbose
- name: Test
run: cargo test --verbose
generate-changelog:
name: Generate Changelog
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/v')
concurrency:
group: changelog-${{ github.repository }}
cancel-in-progress: false
permissions:
contents: write
steps:
- name: Checkout repository (main branch)
uses: actions/checkout@v4
with:
ref: ${{ github.event.repository.default_branch }}
token: ${{ secrets.GITHUB_TOKEN }}
fetch-depth: 0
- name: Fetch tags
run: git fetch --tags
- name: Install git-cliff
uses: taiki-e/install-action@v2
with:
tool: git-cliff
- name: Generate full changelog
run: git cliff -o CHANGELOG.md
- name: Generate release notes
run: git cliff --latest --strip header -o RELEASE_NOTES.md
- name: Commit changelog
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add CHANGELOG.md
if git diff --staged --quiet; then
echo "Changelog already up to date, no commit needed."
else
git commit -m "chore(release): update changelog"
git push origin ${{ github.event.repository.default_branch }}
fi
- name: Upload release notes artifact
uses: actions/upload-artifact@v4
with:
name: release-notes
path: RELEASE_NOTES.md
- name: Create GitHub Release with changelog
uses: softprops/action-gh-release@v2
with:
body_path: RELEASE_NOTES.md
release-binaries:
name: Release binary (${{ matrix.target }})
runs-on: ${{ matrix.runner }}
if: startsWith(github.ref, 'refs/tags/v')
needs: generate-changelog
permissions:
contents: write
strategy:
matrix:
include:
- target: x86_64-unknown-linux-musl
artifact_name: renderflow-x86_64-unknown-linux-musl
binary: target/x86_64-unknown-linux-musl/release/renderflow
runner: ubuntu-latest
use_cross: true
- target: aarch64-unknown-linux-musl
artifact_name: renderflow-aarch64-unknown-linux-musl
binary: target/aarch64-unknown-linux-musl/release/renderflow
runner: ubuntu-latest
use_cross: true
- target: x86_64-unknown-linux-gnu
artifact_name: renderflow-x86_64-unknown-linux-gnu
binary: target/x86_64-unknown-linux-gnu/release/renderflow
runner: ubuntu-latest
use_cross: true
- target: x86_64-pc-windows-gnu
artifact_name: renderflow-x86_64-pc-windows-gnu.exe
binary: target/x86_64-pc-windows-gnu/release/renderflow.exe
runner: ubuntu-latest
use_cross: true
- target: x86_64-apple-darwin
artifact_name: renderflow-x86_64-apple-darwin
binary: target/x86_64-apple-darwin/release/renderflow
runner: macos-13
use_cross: false
- target: aarch64-apple-darwin
artifact_name: renderflow-aarch64-apple-darwin
binary: target/aarch64-apple-darwin/release/renderflow
runner: macos-latest
use_cross: false
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
toolchain: "1.94"
targets: ${{ matrix.target }}
- name: Install cross
if: matrix.use_cross
uses: taiki-e/install-action@v2
with:
tool: cross
- name: Build release binary (cross)
if: matrix.use_cross
run: cross build --target ${{ matrix.target }} --release
- name: Build release binary (cargo)
if: "!matrix.use_cross"
run: cargo build --target ${{ matrix.target }} --release
- name: Rename binary
shell: bash
run: cp ${{ matrix.binary }} ${{ matrix.artifact_name }}
- name: Generate SHA256 checksum
shell: bash
run: |
if command -v sha256sum &>/dev/null; then
sha256sum "${{ matrix.artifact_name }}" > "${{ matrix.artifact_name }}.sha256"
else
shasum -a 256 "${{ matrix.artifact_name }}" > "${{ matrix.artifact_name }}.sha256"
fi
- name: Upload release artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.artifact_name }}
path: |
${{ matrix.artifact_name }}
${{ matrix.artifact_name }}.sha256
- name: Upload binary to GitHub Release
uses: softprops/action-gh-release@v2
with:
files: |
${{ matrix.artifact_name }}
${{ matrix.artifact_name }}.sha256
package-deb:
name: Package .deb (x86_64)
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/v')
needs: generate-changelog
permissions:
contents: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
toolchain: "1.94"
- name: Install cargo-deb
uses: taiki-e/install-action@v2
with:
tool: cargo-deb
- name: Build release binary
run: cargo build --release
- name: Build .deb package
run: cargo deb --no-build
- name: Upload .deb artifact
uses: actions/upload-artifact@v4
with:
name: renderflow-deb-x86_64
path: target/debian/*.deb
- name: Upload .deb to GitHub Release
uses: softprops/action-gh-release@v2
with:
files: target/debian/*.deb
package-rpm:
name: Package .rpm (x86_64)
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/v')
needs: generate-changelog
permissions:
contents: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
toolchain: "1.94"
- name: Install cargo-generate-rpm
uses: taiki-e/install-action@v2
with:
tool: cargo-generate-rpm
- name: Build release binary
run: cargo build --release
- name: Build .rpm package
run: cargo generate-rpm
- name: Upload .rpm artifact
uses: actions/upload-artifact@v4
with:
name: renderflow-rpm-x86_64
path: target/generate-rpm/*.rpm
- name: Upload .rpm to GitHub Release
uses: softprops/action-gh-release@v2
with:
files: target/generate-rpm/*.rpm
validate-pkgbuild:
name: Validate PKGBUILD (Arch Linux)
runs-on: ubuntu-latest
container: archlinux:latest
permissions:
contents: read
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install dependencies
run: pacman -Syu --noconfirm base-devel namcap
- name: Validate PKGBUILD with namcap
run: namcap pkg/aur/renderflow-git/PKGBUILD
update-homebrew-formula:
name: Update Homebrew formula
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/v')
permissions:
contents: write
steps:
- name: Checkout repository (main branch)
uses: actions/checkout@v4
with:
ref: ${{ github.event.repository.default_branch }}
token: ${{ secrets.GITHUB_TOKEN }}
- name: Compute source tarball SHA256
id: formula
run: |
VERSION="${{ github.ref_name }}"
URL="https://github.com/egohygiene/renderflow/archive/refs/tags/${VERSION}.tar.gz"
SHA256=$(curl -fsSL "$URL" | sha256sum | awk '{print $1}')
echo "url=${URL}" >> "$GITHUB_OUTPUT"
echo "sha256=${SHA256}" >> "$GITHUB_OUTPUT"
- name: Update formula url and sha256
run: |
sed -i 's|url "https://github.com/egohygiene/renderflow/archive/refs/tags/.*"|url "${{ steps.formula.outputs.url }}"|' Formula/renderflow.rb
sed -i 's|sha256 ".*"|sha256 "${{ steps.formula.outputs.sha256 }}"|' Formula/renderflow.rb
- name: Commit and push updated formula
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add Formula/renderflow.rb
if git diff --staged --quiet; then
echo "Formula already up to date, no commit needed."
else
git commit -m "chore: update Homebrew formula to ${{ github.ref_name }}"
git push origin ${{ github.event.repository.default_branch }}
fi