Skip to content

Commit 7a83987

Browse files
committed
Add a GitHub CI workflow for building static binaries
1 parent 54b359a commit 7a83987

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

.github/workflows/nix-build.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Nix Build
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches: ["master"]
7+
8+
jobs:
9+
build:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
14+
- name: Checkout
15+
uses: actions/checkout@v4
16+
17+
- name: Install nix
18+
uses: cachix/install-nix-action@v31
19+
with:
20+
nix_path: nixpkgs=channel:nixos-unstable
21+
22+
- name: Build
23+
id: build
24+
run: |
25+
nix build --accept-flake-config .#static
26+
echo "name=$(nix derivation show ./result | jq -r .[].env.name)" >>"$GITHUB_OUTPUT"
27+
echo "artifacts=$(find -L result -type f)" >>"$GITHUB_OUTPUT"
28+
29+
- name: Record system details
30+
id: system-details
31+
run: |
32+
echo "system=$(uname -s)" >>"$GITHUB_OUTPUT"
33+
echo "machine=$(uname -m)" >>"$GITHUB_OUTPUT"
34+
35+
- name: Upload artifacts
36+
uses: actions/upload-artifact@v4
37+
with:
38+
name: ${{ steps.build.outputs.name }}-${{ steps.system-details.outputs.system }}-${{ steps.system-details.outputs.machine }}
39+
path: ${{ steps.build.outputs.artifacts }}

0 commit comments

Comments
 (0)