-
Notifications
You must be signed in to change notification settings - Fork 0
75 lines (75 loc) · 2.66 KB
/
deploy-docs.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# Workflow to build and deploy the docs using a deploy key
name: Deploy documentation to GH Pages
on:
push:
paths:
- "docs/**"
# software paths should only include files which are used by Doxygen
- "software/**/*.cpp"
- "software/**/*.hpp"
- "software/**/*.c"
- "software/**/*.h"
- "software/**/*.py"
- "software/**/*.pyi"
- "flake.nix"
- "flake.lock"
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# only run one job at a time
# needed for the intersphinx update
concurrency:
group: "docs"
cancel-in-progress: true
jobs:
deploy-docs:
# jobs which push to the repo all need to be in this concurrency group
concurrency:
group: "pushers"
permissions:
contents: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
path: source
- uses: nixbuild/nix-quick-install-action@v29
# - uses: DeterminateSystems/magic-nix-cache-action@main
- name: Update intersphinx inventory files
# only run intersphinx update on main branch!
if: ${{ github.ref == 'refs/heads/main' }}
continue-on-error: true # if there are no changes to the files, technically this fails
run: |
cd source
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config user.name "github-actions[bot]"
nix run .#docs.fetch-inventories
git push
- name: Build docs
run: nix build -L ./source#docs
# From here, deploying to the website repo
- name: Checkout website repo
# only run on origin main branch
if: ${{ github.repository == 'ROAR-QUTRC/perseus-v2' && github.ref == 'refs/heads/main' }}
id: checkout-website
uses: actions/checkout@v4
with:
repository: ROAR-QUTRC/roar-qutrc.github.io
ref: main
ssh-key: ${{ secrets.DOCS_DEPLOY_KEY }}
path: docs
- name: Update docs in checked out repo
if: ${{ steps.checkout-website.outcome == 'success' }}
run: |
rm -rf docs/*
# copy from previous nix build
cp -a result/html/. docs/
- name: Commit and push changes
if: ${{ steps.checkout-website.outcome == 'success' }}
continue-on-error: true # if there's nothing to push, this step fails
run: |
cd docs
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config user.name "github-actions[bot]"
git add .
git commit -m "$(date +%z:%Y-%m-%dT%H:%M:%S) Automatic docs update"
git push