-
Notifications
You must be signed in to change notification settings - Fork 4
116 lines (112 loc) · 3.53 KB
/
Copy pathdocs.yml
File metadata and controls
116 lines (112 loc) · 3.53 KB
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
name: Docs
on:
workflow_dispatch:
inputs:
package:
description: 'Package to build documentation for.'
required: true
type: choice
options:
- essreduce
- essimaging
- essnmx
- essreflectometry
- essdiffraction
- esssans
- essspectroscopy
publish:
description: 'Publish documentation to GitHub pages.'
default: false
type: boolean
branch:
description: 'Branch/tag with documentation source. If not set, the current branch will be used.'
default: ''
required: false
type: string
linkcheck:
description: 'Run the link checker.'
default: true
required: false
type: boolean
workflow_call:
inputs:
package:
description: 'Package to build documentation for.'
required: true
type: string
publish:
default: false
type: boolean
branch:
description: 'Branch/tag with documentation source. If not set, the current branch will be used.'
default: ''
required: false
type: string
linkcheck:
description: 'Run the link checker. If not set the link checker will not be run.'
default: false
required: false
type: boolean
env:
PIXI_FROZEN: true
PIXI_NO_INSTALL: true
jobs:
docs:
name: Build documentation
runs-on: 'ubuntu-24.04'
steps:
- uses: actions/checkout@v6
with:
ref: ${{ inputs.branch == '' && github.ref || inputs.branch }}
fetch-depth: 0 # history required to determine version
- uses: prefix-dev/setup-pixi@v0.9.4
with:
pixi-version: v0.78.0
frozen: true
environments: docs-${{ inputs.package }}
- name: Build docs
run: pixi run docs-${{ inputs.package }}
- name: Test docs
run: pixi run docs-${{ inputs.package }} doctest
- name: Linkcheck
run: pixi run docs-${{ inputs.package }} linkcheck
if: ${{ inputs.linkcheck }}
- uses: actions/upload-artifact@v7
id: artifact-upload-step
with:
name: docs-${{ inputs.package }}
path: packages/${{ inputs.package }}/html
if-no-files-found: error
- run: echo "::notice::https://remote-unzip.scipp.deno.net/${{ github.repository }}/artifacts/${{ steps.artifact-upload-step.outputs.artifact-id }}"
deploy:
name: Deploy documentation
needs: [ docs ]
if: ${{ inputs.publish }}
runs-on: 'ubuntu-24.04'
permissions:
contents: write
steps:
- uses: actions/checkout@v6
with:
ref: ${{ inputs.branch == '' && github.ref || inputs.branch }}
- uses: actions/download-artifact@v7
with:
name: docs-${{ inputs.package }}
path: docs_html
- name: Prepare site
run: |
PACKAGE=${{ inputs.package }}
SUBPATH=${PACKAGE#ess}
git fetch origin gh-pages:gh-pages || true
git worktree add gh-pages-site gh-pages || mkdir -p gh-pages-site
rm -rf gh-pages-site/$SUBPATH
mkdir -p gh-pages-site/$SUBPATH
cp -a docs_html/. gh-pages-site/$SUBPATH/
cp docs/index.html gh-pages-site/index.html
touch gh-pages-site/.nojekyll
- name: Build search index
run: npx pagefind@latest --site gh-pages-site --bundle-dir pagefind
- uses: JamesIves/github-pages-deploy-action@v4
with:
branch: gh-pages
folder: gh-pages-site