Skip to content

Commit 86715b6

Browse files
committed
Add GitHub actions
1 parent 9ef711f commit 86715b6

File tree

3 files changed

+100
-0
lines changed

3 files changed

+100
-0
lines changed

.github/workflows/build.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
---
2+
name: "Build & publish artifacts"
3+
on:
4+
push
5+
6+
7+
jobs:
8+
publish_binaries:
9+
name: Build & publish artifacts
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout the repo
13+
uses: actions/checkout@v4
14+
15+
- name: Install nix
16+
uses: cachix/install-nix-action@v12
17+
with:
18+
nix_path: nixpkgs=channel:nixos-unstable
19+
- run: nix --extra-experimental-features nix-command --extra-experimental-features flakes build '.#static'
20+
21+
- name: Upload syslog-client
22+
uses: actions/upload-artifact@v4
23+
with:
24+
name: syslog-client
25+
path: result/bin/syslog-client
26+
if-no-files-found: error
27+
28+
- name: Upload syslog-server
29+
uses: actions/upload-artifact@v4
30+
with:
31+
name: syslog-server
32+
path: result/bin/syslog-server
33+
if-no-files-found: error

.github/workflows/docker.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
---
2+
name: "Build & publish docker image"
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
9+
env:
10+
REGISTRY: ghcr.io
11+
IMAGE_NAME: ${{ github.repository }}
12+
13+
14+
jobs:
15+
publish_docker_image:
16+
name: Build & publish docker image to the GitHub container registry
17+
runs-on: ubuntu-latest
18+
steps:
19+
- name: Checkout the repo
20+
uses: actions/checkout@v4
21+
22+
- name: Install nix
23+
uses: cachix/install-nix-action@v12
24+
with:
25+
nix_path: nixpkgs=channel:nixos-unstable
26+
27+
- name: Login to the container registry
28+
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
29+
with:
30+
registry: ${{ env.REGISTRY }}
31+
username: ${{ github.actor }}
32+
password: ${{ secrets.GITHUB_TOKEN }}
33+
34+
- run: nix --extra-experimental-features nix-command --extra-experimental-features flakes build '.#docker'
35+
- run: docker load <result
36+
- run: docker tag syslog-utils:latest ghcr.io/${IMAGE_NAME}:latest
37+
- run: docker tag syslog-utils:latest ghcr.io/${IMAGE_NAME}:${{ github.ref_name }}
38+
- run: docker push ghcr.io/${IMAGE_NAME}:latest

.github/workflows/release.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
---
2+
name: "Build & publish release binaries"
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
9+
jobs:
10+
publish_binaries:
11+
name: Build & publish release binaries
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Checkout the repo
15+
uses: actions/checkout@v4
16+
17+
- name: Install nix
18+
uses: cachix/install-nix-action@v12
19+
with:
20+
nix_path: nixpkgs=channel:nixos-unstable
21+
- run: nix --extra-experimental-features nix-command --extra-experimental-features flakes build '.#static'
22+
23+
- name: Release
24+
uses: softprops/action-gh-release@v2
25+
with:
26+
files: |
27+
result/bin/syslog-client
28+
result/bin/syslog-server
29+

0 commit comments

Comments
 (0)