1
Fork 0
mirror of https://github.com/RGBCube/hjem synced 2026-01-14 17:21:01 +00:00
hjem/.github/workflows/deploy-docs.yml
NotAShelf 0e292a8df8
ci: build and deploy documentation
Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: I6a6a6964713d4b2ff102220aa2c1361475903dff
2025-09-23 10:00:20 +03:00

62 lines
1.6 KiB
YAML

name: "Build and deploy documentation"
on:
workflow_dispatch:
push:
branches: ["main"]
paths:
- docs/**
- modules/**
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: write
pages: write
id-token: write
# Allow one concurrent deployment
concurrency:
group: "pages"
cancel-in-progress: true
jobs:
check_date:
runs-on: ubuntu-latest
name: Check latest commit
outputs:
should_run: ${{ steps.should_run.outputs.should_run }}
steps:
- uses: actions/checkout@v5
- name: Print latest_commit
run: "echo Latest commit is: ${{ github.sha }}"
- name: Check latest commit is less than a day
id: should_run
if: ${{ github.event_name == 'schedule' }}
continue-on-error: true
run: test -z $(git rev-list --after="24 hours" ${{ github.sha }}) && echo "::set-output name=should_run::false"
publish:
needs: check_date
if: ${{ needs.check_date.outputs.should_run != 'false' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: cachix/install-nix-action@v31
with:
nix_path: nixpkgs=channel:nixos-unstable
- name: Build HTML documentation
run: |
nix build .#docs-html -Lv
# Copy the build manual to the public dir
# which we will serve
cp -r result/share/doc public
- name: Deploy built documentation
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./public