Nix CI #252
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jobs: | |
_1_update_flake_locks: | |
name: Nix CI | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout this repo | |
uses: actions/checkout@v3 | |
- name: Install Nix | |
uses: nixbuild/nix-quick-install-action@v25 | |
with: | |
nix_conf: | | |
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }} | |
substituters = https://cache.nixos.org/ https://nix-community.cachix.org https://cache.iog.io https://deemp.cachix.org | |
trusted-public-keys = cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs= hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ= deemp.cachix.org-1:9shDxyR2ANqEPQEEYDL/xIOnoPwxHot21L5fiZnFL18= | |
keep-outputs = true | |
- name: Restore and cache Nix store | |
uses: deemp/cache-nix-too@v1 | |
with: | |
key: nix-${{ matrix.os }}-cachix-${{ hashfiles('**/flake.nix', '**/flake.lock') }} | |
linux-gc-enabled: true | |
linux-max-store-size: 15000000000 | |
macos-gc-enabled: true | |
macos-max-store-size: 15000000000 | |
restore-keys: | | |
nix-${{ matrix.os }}-cachix-${{ hashfiles('**/flake.nix', '**/flake.lock') }} | |
nix-${{ matrix.os }}-cachix- | |
- name: Remove old cache profiles | |
run: rm -rf /nix/var/nix/profiles/cache | |
- if: matrix.os == 'ubuntu-22.04' | |
name: Config git for github-actions | |
run: | | |
git config user.name github-actions | |
git config user.email github-actions@github.com | |
- if: matrix.os == 'ubuntu-22.04' | |
name: Format Nix files | |
run: |+ | |
nix profile install .#format | |
nix run .#format | |
- if: matrix.os == 'ubuntu-22.04' | |
name: Update flake locks | |
run: |+ | |
git pull --rebase --autostash | |
nix profile install .#updateLocks | |
nix run .#updateLocks | |
git commit -a -m "action: Update flake locks" \ | |
&& git push || echo "push failed!" | |
- env: | |
CACHIX_AUTH_TOKEN: ${{ secrets.CACHIX_AUTH_TOKEN }} | |
CACHIX_CACHE: ${{ secrets.CACHIX_CACHE }} | |
name: Push flakes to Cachix | |
run: |+ | |
nix profile install .#pushToCachix | |
nix run .#pushToCachix | |
strategy: | |
matrix: | |
os: | |
- macos-11 | |
- macos-12 | |
- ubuntu-20.04 | |
- ubuntu-22.04 | |
_2_front: | |
name: Publish static files | |
permissions: | |
contents: write | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Checkout this repo | |
uses: actions/checkout@v3 | |
- name: Install Nix | |
uses: nixbuild/nix-quick-install-action@v25 | |
with: | |
nix_conf: | | |
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }} | |
substituters = https://cache.nixos.org/ https://nix-community.cachix.org https://cache.iog.io https://deemp.cachix.org | |
trusted-public-keys = cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs= hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ= deemp.cachix.org-1:9shDxyR2ANqEPQEEYDL/xIOnoPwxHot21L5fiZnFL18= | |
keep-outputs = true | |
- name: Build docs. | |
run: | | |
nix profile install .#genDocs | |
nix run .#genDocs | |
cp -r docs/book docs/dist | |
- name: Config git for github-actions | |
run: | | |
git config user.name github-actions | |
git config user.email github-actions@github.com | |
- name: Update docs | |
run: | | |
git add "docs/src" | |
git commit -a -m "Update docs" && git push || echo "push failed!" | |
- name: GitHub Pages action | |
uses: peaceiris/actions-gh-pages@v3.9.3 | |
with: | |
force_orphan: true | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: ./docs/dist | |
name: Nix CI | |
"on": | |
pull_request: {} | |
push: {} | |
schedule: | |
- cron: 0 0 * * * | |
workflow_dispatch: {} |