Skip to content

Check flake

Check flake #22

Workflow file for this run

name: Check flake
on:
push:
path:
- ./**.nix
- ./flake.lock
schedule:
- cron: 5 4 * * 5 # At 04:05 on Friday.
env:
REGISTRY: ghcr.io
IMAGE_NAME: jalil-salame/lix
jobs:
check:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: DeterminateSystems/nix-installer-action@v10
- uses: DeterminateSystems/magic-nix-cache-action@v4
- name: Run `nix flake check`
run: nix flake check --accept-flake-config
buildImage:
needs: check
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: DeterminateSystems/nix-installer-action@v10
- uses: DeterminateSystems/magic-nix-cache-action@v4
- name: Build Docker Image
run: |
nix build --accept-flake-config --print-build-logs
cp -v "$(realpath result/image.tar.gz)" lix-image.tar.gz
- name: Archive production artifacts
uses: actions/upload-artifact@v4
with:
name: lix-docker-image
path: lix-image.tar.gz
pushImage:
runs-on: ubuntu-22.04
needs: [check, buildImage]
if: github.ref == 'refs/heads/main'
steps:
- uses: actions/checkout@v4
- name: Download built image
uses: actions/download-artifact@v4
with:
name: lix-docker-image
- name: Push docker image
run: |
docker load <lix-image.tar.gz
docker image list
echo "${{ secrets.GITHUB_TOKEN }}" | docker login --username "${{ github.actor }}" --password-stdin "$REGISTRY"
docker image tag nix:2.90.0-beta.1 "$REGISTRY/$IMAGE_NAME:latest"
docker push "$REGISTRY/$IMAGE_NAME:latest"
lockfile:
runs-on: ubuntu-22.04
needs: check
if: ${{ github.event_name == 'schedule' }} # only run when scheduled
steps:
- uses: actions/checkout@v4
- uses: DeterminateSystems/nix-installer-action@v10
- uses: DeterminateSystems/update-flake-lock@v21
- name: Run `nix flake check`
run: nix flake check --accept-flake-config