-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
106 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
# create a documentation web site for GSAS-II from four sources | ||
# * HTML tutorials are simply copied | ||
# * markdown tutorials (in ./MDtutorials) are formatted with pandoc and are copied over | ||
# * HTML help files are copied over from the GSAS-II sources | ||
# * sphinx is used to generate HTML from files in ./webdocs | ||
|
||
# Also the tutorials.html file and the */data/index.html files are | ||
# created by running scripts/makeGitTutorial | ||
|
||
name: build GSAS-II web site | ||
|
||
#on: [workflow_dispatch] | ||
on: [push, workflow_dispatch] | ||
|
||
permissions: | ||
contents: write | ||
id-token: write | ||
pages: write | ||
|
||
jobs: | ||
build: # Build web pages | ||
runs-on: ubuntu-latest | ||
steps: | ||
|
||
- name: Python setup | ||
uses: actions/setup-python@v3 | ||
- name: Sphinx setup | ||
run: | | ||
pip install sphinx sphinx_readable_theme | ||
- name: pandoc setup | ||
uses: pandoc/actions/setup@v1 | ||
|
||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Get tutorials index from source code | ||
run: | | ||
curl -L https://github.com/AdvancedPhotonSource/GSAS-II/raw/master/GSASII/tutorialIndex.py -o scripts/tutorialIndex.py | ||
- name: build tutorials index | ||
run: | | ||
cd scripts | ||
python makeGitTutorial.py .. | ||
- name: Push changes | ||
uses: ad-m/github-push-action@master | ||
|
||
- name: convert tutorials | ||
run: | | ||
cd MDtutorials | ||
for path in ./*; do | ||
[ -d "${path}" ] || continue # skip if not a directory | ||
dirname="$(basename "${path}")" | ||
dest="../${dirname}" | ||
mkdir ${dest} | ||
[ ! -d "${path}/data" ] || cp -r "${path}/data" ${dest}/ | ||
[ ! -d "${path}/imgs" ] || cp -r "${path}/imgs" ${dest}/ | ||
cp tutorial.css ${dest} | ||
for fil in $dirname/*.md; do | ||
outfile="${dest}/$(basename "${fil%.md}.html")" | ||
echo "creating $outfile from $fil" | ||
pandoc --standalone ${fil} --css tutorial.css -o ${outfile} | ||
sed -i "s/<figure>/<BR clear=all><figure>/g" ${outfile} | ||
done | ||
done | ||
- name: Sphinx build | ||
run: | | ||
sphinx-build webdocs . # place output into root dir | ||
cp webdocs/_static/fix.css _static/fix.css # should be done by sphinx | ||
# get the help pages from the GSAS-II sources into the web site | ||
- name: Get GSAS-II | ||
run: | | ||
git clone --depth 1 https://github.com/AdvancedPhotonSource/GSAS-II.git _gsas2 | ||
- name: move help into site | ||
run: | | ||
mv _gsas2/GSASII/help ./help | ||
- name: Get rid of the rest of the GSAS-II files & other stuff not needed on web | ||
run: | | ||
rm -rf _gsas2 webdocs scripts | ||
- name: Upload artifact # creates zip file with website contents | ||
uses: actions/upload-pages-artifact@v3 | ||
with: | ||
path: . | ||
name: github-pages | ||
retention-days: 1 | ||
|
||
deploy: # Deployment of web pages to GitHub pages | ||
needs: build | ||
permissions: | ||
pages: write | ||
id-token: write | ||
environment: | ||
name: github-pages | ||
url: ${{ steps.deployment.outputs.page_url }} | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Deploy to GitHub Pages | ||
id: deployment | ||
uses: actions/deploy-pages@v4 | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
artifact_name: github-pages |
This file was deleted.
Oops, something went wrong.