nixfiles/.gitea/workflows/ci.yaml

41 lines
1.3 KiB
YAML
Raw Normal View History

2023-11-16 22:00:49 +00:00
name: CI
on:
push:
branches: [master]
jobs:
check:
2023-11-17 15:39:31 +00:00
name: Check, build and cache Nix flake
2023-11-16 22:00:49 +00:00
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
2023-11-17 15:05:19 +00:00
- name: Install jq
run: apt-get update -y && apt-get install -y jq
2023-11-16 22:00:49 +00:00
- uses: cachix/install-nix-action@v23
with:
# Gitea will supply a token in GITHUB_TOKEN, which this action will
# try to pass to Nix when downloading from GitHub
github_access_token: ${{ secrets.GH_PULL_TOKEN }}
extra_nix_config: |
# Make sure we're using sandbox
sandbox-fallback = false
2023-11-17 15:05:19 +00:00
extra-substituters = https://nix-cache.nul.ie/main
2023-11-17 21:45:29 +00:00
extra-trusted-public-keys = main:mMChkG8LwXrFirVfudqjSHasK1jV31OVElYD3eImYl8=
2023-11-17 15:05:19 +00:00
- name: Set up attic
run: |
nix run .#nixpkgs.mine.x86_64-linux.attic-client -- \
login --set-default colony https://nix-cache.nul.ie "${{ secrets.NIX_CACHE_TOKEN }}"
2023-11-16 22:00:49 +00:00
2023-11-17 15:39:31 +00:00
- name: Check and build flake
id: build
run: |
nix flake check
path=$(nix build --no-link .#ci.x86_64-linux --json | jq -r .[0].outputs.out)
echo "path=$path" >> "$GITHUB_OUTPUT"
2023-11-17 15:05:19 +00:00
- name: Push to cache
run: |
nix run .#nixpkgs.mine.x86_64-linux.attic-client -- \
2023-11-17 15:39:31 +00:00
push main ${{ steps.build.outputs.path }}