name: CI

on:
  push:
    branches:
      - main
    paths-ignore:
      - "README.md"
  schedule:
    - cron: "0 12 15 * *"
  workflow_dispatch:

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4

      - uses: cachix/install-nix-action@6ed004b9ccb68dbc28e7c85bee15fa93dbd214ac # v22
        with:
          nix_path: nixpkgs=channel:nixos-23.05

      - run: nix develop --command just ci-test
      - run: nix develop --command just build

      - run: |
          echo "DATE=$(date '+%Y-%m-%d-%H.%M.%S')" >> $GITHUB_ENV

      - uses: ncipollo/release-action@6c75be85e571768fa31b40abf38de58ba0397db5 # v1.13.0
        with:
          artifacts: dist/build-configs
          tag: ${{ env.DATE }}