Nix CI tryouts
Build image / build-image (push) Successful in 24s

This commit is contained in:
2025-10-06 03:26:14 +02:00
committed by Paul Brinkmeier
parent 7cf2f53793
commit 96dc4c924d
2 changed files with 38 additions and 17 deletions
+21 -13
View File
@@ -6,27 +6,35 @@ on:
jobs:
build-image:
container:
image: catthehacker/ubuntu:act-latest
image: node:24-bookworm
env:
USER: node
HOME: /home/node
NIX_CONFIG: experimental-features = nix-command flakes
volumes:
- /home/paul/nix-ci/nix-runner-nix:/nix
- /home/paul/nix-ci/nix-runner-etc-nix:/etc/nix
- /home/paul/nix-ci/nix-runner-home-node:/home/node
options: --user 1000:1000 --group-add 988
steps:
- name: Prep nix env
run: |
if [ ! -f ~/.nix-profile/etc/profile.d/nix.sh ]; then
curl -L https://nixos.org/nix/install | bash -s -- --no-daemon
fi
. ~/.nix-profile/etc/profile.d/nix.sh
env >> "$GITHUB_ENV"
- name: Checkout repo
uses: actions/checkout@v4
# Required for installing nix
- name: Install sudo
run: apt-get update && apt-get install -y sudo
- name: Install Nix
uses: cachix/install-nix-action@v31
with:
enable_kvm: false
- name: Get image meta
run: nix build .#image-meta -o image-meta
- name: Version check
run: |
VERSION=$(cat image-meta/version)
[ "$GITHUB_REF_NAME" = v"$VERSION" ]
- name: Build image
run: nix build .#image -o image.tar.gz
- run: docker login -u paul -p "$PASSWORD" git.pbrinkmeier.de
- run: nix build --log-format raw --print-build-logs .#image -o image.tar.gz
- run: gunzip -c image.tar.gz > image.tar
- run: nix run .#crane -- auth login git.pbrinkmeier.de -u paul -p "$PASSWORD"
env:
PASSWORD: "${{ secrets.REGISTRY_PASSWORD }}"
- run: docker load < image.tar.gz
- run: docker image push $(cat image-meta/name)
- run: nix run .#crane -- push image.tar $(cat image-meta/name)