Skip to content

Commit

Permalink
Add GitHub actions
Browse files Browse the repository at this point in the history
  • Loading branch information
koenw committed Nov 23, 2024
1 parent 9ef711f commit 86715b6
Show file tree
Hide file tree
Showing 3 changed files with 100 additions and 0 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
name: "Build & publish artifacts"
on:
push


jobs:
publish_binaries:
name: Build & publish artifacts
runs-on: ubuntu-latest
steps:
- name: Checkout the repo
uses: actions/checkout@v4

- name: Install nix
uses: cachix/install-nix-action@v12
with:
nix_path: nixpkgs=channel:nixos-unstable
- run: nix --extra-experimental-features nix-command --extra-experimental-features flakes build '.#static'

- name: Upload syslog-client
uses: actions/upload-artifact@v4
with:
name: syslog-client
path: result/bin/syslog-client
if-no-files-found: error

- name: Upload syslog-server
uses: actions/upload-artifact@v4
with:
name: syslog-server
path: result/bin/syslog-server
if-no-files-found: error
38 changes: 38 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
---
name: "Build & publish docker image"
on:
push:
tags:
- 'v*'


env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}


jobs:
publish_docker_image:
name: Build & publish docker image to the GitHub container registry
runs-on: ubuntu-latest
steps:
- name: Checkout the repo
uses: actions/checkout@v4

- name: Install nix
uses: cachix/install-nix-action@v12
with:
nix_path: nixpkgs=channel:nixos-unstable

- name: Login to the container registry
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- run: nix --extra-experimental-features nix-command --extra-experimental-features flakes build '.#docker'
- run: docker load <result
- run: docker tag syslog-utils:latest ghcr.io/${IMAGE_NAME}:latest
- run: docker tag syslog-utils:latest ghcr.io/${IMAGE_NAME}:${{ github.ref_name }}
- run: docker push ghcr.io/${IMAGE_NAME}:latest
29 changes: 29 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
name: "Build & publish release binaries"
on:
push:
tags:
- 'v*'


jobs:
publish_binaries:
name: Build & publish release binaries
runs-on: ubuntu-latest
steps:
- name: Checkout the repo
uses: actions/checkout@v4

- name: Install nix
uses: cachix/install-nix-action@v12
with:
nix_path: nixpkgs=channel:nixos-unstable
- run: nix --extra-experimental-features nix-command --extra-experimental-features flakes build '.#static'

- name: Release
uses: softprops/action-gh-release@v2
with:
files: |
result/bin/syslog-client
result/bin/syslog-server

0 comments on commit 86715b6

Please sign in to comment.