Skip to content

Commit 2d4158f

Browse files
committed
new build process w/pandoc
1 parent 9c7d3db commit 2d4158f

File tree

2 files changed

+106
-41
lines changed

2 files changed

+106
-41
lines changed

.github/workflows/builddocsite.yml

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
# create a documentation web site for GSAS-II from four sources
2+
# * HTML tutorials are simply copied
3+
# * markdown tutorials (in ./MDtutorials) are formatted with pandoc and are copied over
4+
# * HTML help files are copied over from the GSAS-II sources
5+
# * sphinx is used to generate HTML from files in ./webdocs
6+
7+
# Also the tutorials.html file and the */data/index.html files are
8+
# created by running scripts/makeGitTutorial
9+
10+
name: build GSAS-II web site
11+
12+
#on: [workflow_dispatch]
13+
on: [push, workflow_dispatch]
14+
15+
permissions:
16+
contents: write
17+
id-token: write
18+
pages: write
19+
20+
jobs:
21+
build: # Build web pages
22+
runs-on: ubuntu-latest
23+
steps:
24+
25+
- name: Python setup
26+
uses: actions/setup-python@v3
27+
- name: Sphinx setup
28+
run: |
29+
pip install sphinx sphinx_readable_theme
30+
- name: pandoc setup
31+
uses: pandoc/actions/setup@v1
32+
33+
- name: Checkout
34+
uses: actions/checkout@v4
35+
36+
- name: Get tutorials index from source code
37+
run: |
38+
curl -L https://github.com/AdvancedPhotonSource/GSAS-II/raw/master/GSASII/tutorialIndex.py -o scripts/tutorialIndex.py
39+
40+
- name: build tutorials index
41+
run: |
42+
cd scripts
43+
python makeGitTutorial.py ..
44+
45+
- name: Push changes
46+
uses: ad-m/github-push-action@master
47+
48+
- name: convert tutorials
49+
run: |
50+
cd MDtutorials
51+
for path in ./*; do
52+
[ -d "${path}" ] || continue # skip if not a directory
53+
dirname="$(basename "${path}")"
54+
dest="../${dirname}"
55+
mkdir ${dest}
56+
[ ! -d "${path}/data" ] || cp -r "${path}/data" ${dest}/
57+
[ ! -d "${path}/imgs" ] || cp -r "${path}/imgs" ${dest}/
58+
cp tutorial.css ${dest}
59+
for fil in $dirname/*.md; do
60+
outfile="${dest}/$(basename "${fil%.md}.html")"
61+
echo "creating $outfile from $fil"
62+
pandoc --standalone ${fil} --css tutorial.css -o ${outfile}
63+
sed -i "s/<figure>/<BR clear=all><figure>/g" ${outfile}
64+
done
65+
done
66+
67+
- name: Sphinx build
68+
run: |
69+
sphinx-build webdocs . # place output into root dir
70+
cp webdocs/_static/fix.css _static/fix.css # should be done by sphinx
71+
72+
# get the help pages from the GSAS-II sources into the web site
73+
- name: Get GSAS-II
74+
run: |
75+
git clone --depth 1 https://github.com/AdvancedPhotonSource/GSAS-II.git _gsas2
76+
- name: move help into site
77+
run: |
78+
mv _gsas2/GSASII/help ./help
79+
- name: Get rid of the rest of the GSAS-II files & other stuff not needed on web
80+
run: |
81+
rm -rf _gsas2 webdocs scripts
82+
83+
- name: Upload artifact # creates zip file with website contents
84+
uses: actions/upload-pages-artifact@v3
85+
with:
86+
path: .
87+
name: github-pages
88+
retention-days: 1
89+
90+
deploy: # Deployment of web pages to GitHub pages
91+
needs: build
92+
permissions:
93+
pages: write
94+
id-token: write
95+
environment:
96+
name: github-pages
97+
url: ${{ steps.deployment.outputs.page_url }}
98+
runs-on: ubuntu-latest
99+
100+
steps:
101+
- name: Deploy to GitHub Pages
102+
id: deployment
103+
uses: actions/deploy-pages@v4
104+
with:
105+
token: ${{ secrets.GITHUB_TOKEN }}
106+
artifact_name: github-pages

.github/workflows/test_build.yml

Lines changed: 0 additions & 41 deletions
This file was deleted.

0 commit comments

Comments
 (0)