Skip to content

Merge pull request #2 from deftdevs/flake-packages #14

Merge pull request #2 from deftdevs/flake-packages

Merge pull request #2 from deftdevs/flake-packages #14

Workflow file for this run

name: CI
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
release:
types: [ published ]
jobs:
build:
name: Build Image
runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Nix
uses: cachix/install-nix-action@v27
with:
nix_path: nixpkgs=channel:nixos-23.11
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Login to GitHub container registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build image
run: |
nix build
- name: Load image
id: image
run: |
image_id=$(docker load < result | sed -n 's/^Loaded image: //p')
echo "image_id=${image_id}" | tee "$GITHUB_ENV"
- name: Push image
run: |
image_name=${image_id%:*}
image_tags="canary"
if [[ "${{ github.event_name }}" == "release" ]]; then
image_tags="${{ github.event.release.tag_name }},latest"
elif [[ "${{ github.event_name }}" == "pull_request" ]]; then
image_tags="pr${{github.event.number}}"
fi
for image_tag in ${image_tags//,/ }
do
docker tag ${image_id} ghcr.io/${{ github.repository_owner }}/${image_name}:${image_tag}
docker push ghcr.io/${{ github.repository_owner }}/${image_name}:${image_tag}
done
- name: Inspect image
run: |
docker image inspect ${image_id}