mirror of
https://github.com/youwen5/blog.git
synced 2024-11-24 18:03:50 -08:00
61 lines
1.7 KiB
YAML
61 lines
1.7 KiB
YAML
name: CI
|
|
|
|
on:
|
|
pull_request:
|
|
push:
|
|
|
|
jobs:
|
|
build-nix:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: |
|
|
actions/checkout@v4
|
|
DeterminateSystems/nix-installer-action@main
|
|
DeterminateSystems/magic-nix-cache-action@main
|
|
|
|
- name: Install Nix
|
|
uses: cachix/install-nix-action@v30
|
|
with:
|
|
github_access_token: ${{ secrets.GITHUB_TOKEN }}
|
|
extra_nix_config: |
|
|
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
|
|
allow-import-from-derivation = true
|
|
auto-optimise-store = true
|
|
experimental-features = nix-command flakes
|
|
substituters = https://cache.nixos.org https://cache.iog.io
|
|
trusted-public-keys = cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ=
|
|
|
|
- name: Build with cachix
|
|
uses: cachix/cachix-action@v15
|
|
# with:
|
|
# name: hakyll-nix-template
|
|
# authToken: ${{ secrets.CACHIX_AUTH_TOKEN }}
|
|
|
|
- run: nix build --accept-flake-config
|
|
|
|
- name: Artifact pages
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: pages
|
|
path: result/dist
|
|
|
|
deploy:
|
|
if: github.ref == 'refs/heads/main'
|
|
runs-on: ubuntu-latest
|
|
needs: [build-nix]
|
|
|
|
steps:
|
|
- name: Download artifact
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
name: pages
|
|
path: result
|
|
|
|
- name: Deploy to GitHub Pages
|
|
if: success()
|
|
uses: crazy-max/ghaction-github-pages@v4.0.0
|
|
with:
|
|
build_dir: result
|
|
target_branch: gh-pages
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|