-
Notifications
You must be signed in to change notification settings - Fork 4
208 lines (168 loc) · 7.03 KB
/
BuildDocs.yml
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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
# This is a basic workflow to help you get started with Actions
name: BuildDocs
# Controls when the workflow will run
on:
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
inputs:
quickAndDirty:
description: 'TESTING ONLY: Set to "true" to generate the site quickly but without history being added to every page'
required: true
default: 'false'
externalUrlCheck:
description: '"true" (VERY SLOW) means try to access any links to external sites. "false" (fast) will still check internal links'
required: true
default: 'false'
# Allow this workflow to be called by other workflows
workflow_call:
inputs:
quickAndDirty:
description: 'TESTING ONLY: Set to "true" to generate the site quickly but without history being added to every page'
required: true
type: string
default: 'false'
externalUrlCheck:
description: '"true" (VERY SLOW) means try to access any links to external sites. "false" (fast) will still check internal links'
required: true
type: string
default: 'false'
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Install the requirements of the python scripts
- run: python -V
- run: pip install marko==2.0.0
# First get all the repositories we will use to build any of the sites
# Need to include fetch-depth: 0 in order to get the history so it can be included in the doc
# This repo
- name: Checkout docs
uses: actions/checkout@v3
with:
path: main
fetch-depth: 0
# This repo's wiki (the Official docs wiki)
- name: Checkout docs wiki repo
uses: actions/checkout@v3
with:
repository: delph-in/docs.wiki
path: docswiki
fetch-depth: 0
# Create blank sites and then
# process and copy all pages into the sites
- run: python $GITHUB_WORKSPACE/main/sitescripts/createdocs.py https://delph-in.github.io/docs $GITHUB_WORKSPACE/ $GITHUB_WORKSPACE/main/latestsrc/ $GITHUB_WORKSPACE/main/latestsites/ $GITHUB_WORKSPACE/main/sitesdefinitions.json ${{ github.event.inputs.quickAndDirty }} ${{ github.event.inputs.externalUrlCheck }}
# Build the index using the new site data
- name: Build Search Index
uses: ./main/.github/actions/buildindex # Uses an action in the root directory
id: buildindex
with:
json-data-file-path: ./main/latestsrc/index_source.js
index-file-path: ./main/latestsites/index.json
ref-to-teaser-path: ./main/latestsites/refToTeaser.json
# Upload any output data so users can get at it
- uses: actions/upload-artifact@v3
if: ${{ failure() }}
with:
name: Site Errors
path: main/latestsrc/SiteErrors.json
if-no-files-found: ignore # 'warn' or 'ignore' are also available, defaults to `warn`
- uses: actions/upload-artifact@v3
with:
name: All Pages
path: main/latestsrc/AllPages.json
if-no-files-found: ignore # 'warn' or 'ignore' are also available, defaults to `warn`
- uses: actions/upload-artifact@v3
with:
name: All Links (working, broken, local, external, etc)
path: main/latestsrc/AllLinks.json
if-no-files-found: ignore # 'warn' or 'ignore' are also available, defaults to `warn`
- uses: actions/upload-artifact@v3
with:
name: Fixes for broken links To Wiki pages
path: main/latestsrc/FixesForBrokenLinksToWikiPages.json
if-no-files-found: ignore # 'warn' or 'ignore' are also available, defaults to `warn`
# Build each site with Jekyll
- name: Setup Pages
uses: actions/configure-pages@v1
- name: Build Home with Jekyll
uses: actions/jekyll-build-pages@v1
with:
source: ./main/latestsrc/home
destination: main/latestsites/home
- name: Build How-to with Jekyll
uses: actions/jekyll-build-pages@v1
with:
source: ./main/latestsrc/howto
destination: main/latestsites/howto
- name: Build Garage with Jekyll
uses: actions/jekyll-build-pages@v1
with:
source: ./main/latestsrc/garage
destination: main/latestsites/garage
- name: Build Tools with Jekyll
uses: actions/jekyll-build-pages@v1
with:
source: ./main/latestsrc/tools
destination: main/latestsites/tools
- name: Build Matrix with Jekyll
uses: actions/jekyll-build-pages@v1
with:
source: ./main/latestsrc/matrix
destination: main/latestsites/matrix
- name: Build Summits with Jekyll
uses: actions/jekyll-build-pages@v1
with:
source: ./main/latestsrc/summits
destination: main/latestsites/summits
- name: Build ERG with Jekyll
uses: actions/jekyll-build-pages@v1
with:
source: ./main/latestsrc/erg
destination: main/latestsites/erg
- name: Build Grammars with Jekyll
uses: actions/jekyll-build-pages@v1
with:
source: ./main/latestsrc/grammars
destination: main/latestsites/grammars
- name: Upload all the sites to github pages
uses: actions/upload-pages-artifact@v1
with:
path: main/latestsites/
# Now commit and push all the changes to record this version of the docs
# As long as we are in main, otherwise don't do this because it makes merges a bear
- run: echo ${{ github.ref }}
- name: Commit files
if: ${{ github.ref == 'refs/heads/main'}}
run: |
cd $GITHUB_WORKSPACE/main
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git add .
git commit -m "[BOT] Automatic documentation build" -a
- name: Push changes
if: ${{ github.ref == 'refs/heads/main'}}
uses: ad-m/github-push-action@master
with:
directory: main
branch: ${{ github.ref }}
# Deploy the pages to github pages
deploy:
# Add a dependency to the build job
needs: build
# Grant GITHUB_TOKEN the permissions required to make a Pages deployment
permissions:
pages: write # to deploy to Pages
id-token: write # to verify the deployment originates from an appropriate source
# Deploy to the github-pages environment
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
# Specify runner + deployment step
runs-on: ubuntu-latest
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v1