Skip to content

Commit 9127e1a

Browse files
committed
ci: add release workflow
1 parent 82fbfb7 commit 9127e1a

File tree

1 file changed

+90
-0
lines changed

1 file changed

+90
-0
lines changed

.github/workflows/release.yaml

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*"
7+
8+
jobs:
9+
release:
10+
runs-on: ubuntu-latest
11+
permissions:
12+
contents: write
13+
14+
strategy:
15+
matrix:
16+
target:
17+
- os: linux
18+
arch: x86_64
19+
zig_target: x86_64-linux
20+
- os: linux
21+
arch: aarch64
22+
zig_target: aarch64-linux
23+
- os: macos
24+
arch: x86_64
25+
zig_target: x86_64-macos
26+
- os: macos
27+
arch: aarch64
28+
zig_target: aarch64-macos
29+
- os: windows
30+
arch: x86_64
31+
zig_target: x86_64-windows
32+
- os: windows
33+
arch: aarch64
34+
zig_target: aarch64-windows
35+
36+
steps:
37+
- name: Check out repository
38+
uses: actions/checkout@v4
39+
40+
- name: Set up Zig
41+
uses: mlugg/setup-zig@v2
42+
43+
- name: Build for ${{ matrix.target.os }}-${{ matrix.target.arch }}
44+
run: |
45+
zig build -Dtarget=${{ matrix.target.zig_target }} -Doptimize=ReleaseSafe
46+
47+
# Create output directory
48+
mkdir -p artifacts
49+
50+
# Copy binary with appropriate naming
51+
if [[ "${{ matrix.target.os }}" == "windows" ]]; then
52+
cp zig-out/bin/bchunk.exe artifacts/bchunk-${{ matrix.target.os }}-${{ matrix.target.arch }}.exe
53+
else
54+
cp zig-out/bin/bchunk artifacts/bchunk-${{ matrix.target.os }}-${{ matrix.target.arch }}
55+
fi
56+
57+
- name: Upload artifact
58+
uses: actions/upload-artifact@v4
59+
with:
60+
name: bchunk-${{ matrix.target.os }}-${{ matrix.target.arch }}
61+
path: artifacts/
62+
63+
create-release:
64+
needs: release
65+
runs-on: ubuntu-latest
66+
permissions:
67+
contents: write
68+
69+
steps:
70+
- name: Check out repository
71+
uses: actions/checkout@v4
72+
73+
- name: Download all artifacts
74+
uses: actions/download-artifact@v4
75+
with:
76+
path: release-artifacts
77+
78+
- name: Prepare release assets
79+
run: |
80+
mkdir -p release-assets
81+
find release-artifacts -name "bchunk-*" -type f -exec cp {} release-assets/ \;
82+
ls -la release-assets/
83+
84+
- name: Create Release
85+
uses: softprops/action-gh-release@v2
86+
with:
87+
files: release-assets/*
88+
generate_release_notes: true
89+
draft: false
90+
prerelease: false

0 commit comments

Comments
 (0)