Skip to content

work on permission to commit #27

work on permission to commit

work on permission to commit #27

# 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
# * 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
# this is a development version that creates draft help pages from the MDhelp directory
# For now
# * HTML help files are copied over from the GSAS-II sources
# Eventually, the help files generated here need to get into the GSASII/help
# directory
name: build GSAS-II web site w/test MD Help
on:
workflow_dispatch:
push:
branches:
- newhelp
permissions:
contents: write
pull-requests: write
id-token: write
pages: write
jobs:
build: # Build web pages
runs-on: ubuntu-latest
steps:
- name: Python setup
uses: actions/setup-python@v3
# Code below removed for more rapid testing
# - name: Sphinx setup
# run: |
# pip install sphinx sphinx_readable_theme
# - name: pandoc setup
# uses: pandoc/actions/setup@v1
# Code below removed for more rapid testing
# # MD help tools
# - name: install debian chrome
# run: |
# set -ex
# wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
# sudo apt install ./google-chrome-stable_current_amd64.deb
# - name: test newly-installed chrome
# run: |
# which google-chrome-stable
# google-chrome-stable --version
# /usr/bin/google-chrome-stable --headless --disable-gpu --dump-dom https://google.com
- name: mkdocs setup
run: |
pip install mkdocs mkdocs-material python-markdown-math mkdocs-static-i18n
pip install mkdocs-to-pdf pymdown-extensions
- name: Checkout
uses: actions/checkout@v4
# MD help conversion
- name: convert MDhelp
run: |
cd MDhelp
mkdocs build
#ENABLE_PDF_EXPORT=1 mkdocs build
#mv site/GSASII-help.pdf ../docs/
# create an anchor index
python findMDanchors.py
cp -vr site ../help
# - name: Upload help artifact # debug: creates zip file with website contents
# uses: actions/upload-pages-artifact@v3
# with:
# path: MDhelp/site
# name: MDhelp
# retention-days: 1
# Code below removed for more rapid testing
# - 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
# Code below removed for more rapid testing
# - name: convert tutorials
# run: |
# cd MDtutorials
# for path in ./*; do
# [ -d "${path}" ] || continue # skip if not a directory
# dirname="$(basename "${path}")"
# dest="../${dirname}"
# mkdir -pv ${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
# git add ${dest}
# done
# cd ..
# Code below removed for more rapid testing
# - name: build tutorials index
# run: |
# cd scripts
# python makeGitTutorial.py ..
# - name: Note changed files # unused development code
# run: |
# git add tutorials.html
# git add */data/index.html
# git status
# git commit -m"changes from automated build of tutorials"
# - name: Push changes
# uses: ad-m/github-push-action@master
# Code below removed for more rapid testing
# - 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 new help pages into the GSAS-II sources
- name: Checkout
uses: actions/checkout@v4
with:
repository: AdvancedPhotonSource/GSAS-II.git
path: _gsas2
ref: newhelp
# token: ''
- name: move help into site
run: |
#rm -rf _gsas2/GSASII/help/assets/javascripts/
rm -rf _gsas2/GSASII/help/assets/stylesheets/
cp -rpv MDhelp/site/* _gsas2/GSASII/help
cd _gsas2
git status
git diff
git add GSASII/help
echo "After add"
git status
- name: commit changes
run: |
cd _gsas2
git commit -m"update help files"
- name: push help into site
run: |
cd _gsas2
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git push
# before uploading, clean up
- name: Get rid of the rest of the GSAS-II files & other stuff not needed on web
run: |
rm -rf _gsas2 webdocs scripts MDtutorials MDhelp
# Code below removed for more rapid testing
# - 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