|
| 1 | +# work on building PDFs from the .md help files |
| 2 | + |
| 3 | + |
| 4 | +name: test MD help to .pdf |
| 5 | + |
| 6 | +#on: [workflow_dispatch] |
| 7 | +on: [push, workflow_dispatch] |
| 8 | + |
| 9 | +permissions: |
| 10 | + contents: write |
| 11 | + id-token: write |
| 12 | + pages: write |
| 13 | + |
| 14 | +jobs: |
| 15 | + build: # Build web pages |
| 16 | + runs-on: ubuntu-latest |
| 17 | + steps: |
| 18 | + |
| 19 | + |
| 20 | + # - name: test installed chrome |
| 21 | + # run: | |
| 22 | + # which chrome |
| 23 | + # chrome --version |
| 24 | + |
| 25 | + - name: install debian chrome |
| 26 | + run: | |
| 27 | + set -ex |
| 28 | + wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb |
| 29 | + sudo apt install ./google-chrome-stable_current_amd64.deb |
| 30 | + |
| 31 | +# - name: test newly-installed chrome |
| 32 | +# run: | |
| 33 | +# which google-chrome-stable |
| 34 | +# google-chrome-stable --version |
| 35 | +# /usr/bin/google-chrome-stable --headless --disable-gpu --dump-dom https://google.com |
| 36 | + |
| 37 | + - name: Python setup |
| 38 | + uses: actions/setup-python@v3 |
| 39 | +# - name: Sphinx setup |
| 40 | +# run: | |
| 41 | +# pip install sphinx sphinx_readable_theme |
| 42 | +# - name: pandoc setup |
| 43 | +# uses: pandoc/actions/setup@v1 |
| 44 | + - name: mkdocs setup |
| 45 | + run: | |
| 46 | + pip install mkdocs mkdocs-material python-markdown-math mkdocs-static-i18n |
| 47 | + pip install pymdown-extensions |
| 48 | + #pip install mkdocs-to-pdf |
| 49 | + pip install git+https://github.com/domWalters/mkdocs-to-pdf.git@impl-playwright-pdf-engine |
| 50 | +
|
| 51 | +https://github.com/domWalters/mkdocs-to-pdf.git |
| 52 | + - name: Checkout |
| 53 | + uses: actions/checkout@v4 |
| 54 | + |
| 55 | + - name: convert MDhelp |
| 56 | + run: | |
| 57 | + cd MDhelp |
| 58 | + #mkdocs build |
| 59 | + mv mkdocs.yml_pdf mkdocs.yml |
| 60 | + ENABLE_PDF_EXPORT=1 mkdocs build |
| 61 | + # mv site/GSASII-help.pdf ... |
| 62 | + #cp -vr site ../help_test |
| 63 | + |
| 64 | + - name: Upload help artifact # creates zip file with website contents |
| 65 | + uses: actions/upload-pages-artifact@v3 |
| 66 | + with: |
| 67 | + path: MDhelp/site |
| 68 | + name: MDhelp |
| 69 | + retention-days: 1 |
| 70 | + |
| 71 | + # - name: Get tutorials index from source code |
| 72 | + # run: | |
| 73 | + # curl -L https://github.com/AdvancedPhotonSource/GSAS-II/raw/master/GSASII/tutorialIndex.py -o scripts/tutorialIndex.py |
| 74 | + |
| 75 | + # - name: convert tutorials |
| 76 | + # run: | |
| 77 | + # cd MDtutorials |
| 78 | + # for path in ./*; do |
| 79 | + # [ -d "${path}" ] || continue # skip if not a directory |
| 80 | + # dirname="$(basename "${path}")" |
| 81 | + # dest="../${dirname}" |
| 82 | + # mkdir -pv ${dest} |
| 83 | + # [ ! -d "${path}/data" ] || cp -r "${path}/data" ${dest}/ |
| 84 | + # [ ! -d "${path}/imgs" ] || cp -r "${path}/imgs" ${dest}/ |
| 85 | + # cp tutorial.css ${dest} |
| 86 | + # for fil in $dirname/*.md; do |
| 87 | + # outfile="${dest}/$(basename "${fil%.md}.html")" |
| 88 | + # echo "creating $outfile from $fil" |
| 89 | + # pandoc --standalone ${fil} --css tutorial.css -o ${outfile} |
| 90 | + # sed -i "s/<figure>/<BR clear=all><figure>/g" ${outfile} |
| 91 | + # done |
| 92 | + # git add ${dest} |
| 93 | + # done |
| 94 | + # cd .. |
| 95 | + |
| 96 | + # - name: build tutorials index |
| 97 | + # run: | |
| 98 | + # cd scripts |
| 99 | + # python makeGitTutorial.py .. |
| 100 | + |
| 101 | +# - name: Note changed files |
| 102 | +# run: | |
| 103 | +# git add tutorials.html |
| 104 | +# git add */data/index.html |
| 105 | +# git status |
| 106 | +# git commit -m"changes from automated build of tutorials" |
| 107 | +# - name: Push changes |
| 108 | +# uses: ad-m/github-push-action@master |
| 109 | + |
| 110 | + # - name: Sphinx build |
| 111 | + # run: | |
| 112 | + # sphinx-build webdocs . # place output into root dir |
| 113 | + # cp webdocs/_static/fix.css _static/fix.css # should be done by sphinx |
| 114 | + |
| 115 | + # # get the help pages from the GSAS-II sources into the web site |
| 116 | + # - name: Get GSAS-II |
| 117 | + # run: | |
| 118 | + # git clone --depth 1 https://github.com/AdvancedPhotonSource/GSAS-II.git _gsas2 |
| 119 | + # - name: move help into site |
| 120 | + # run: | |
| 121 | + # mv _gsas2/GSASII/help ./help |
| 122 | + # - name: Get rid of the rest of the GSAS-II files & other stuff not needed on web |
| 123 | + # run: | |
| 124 | + # rm -rf _gsas2 webdocs scripts MDtutorials MDhelp |
| 125 | + |
| 126 | + # - name: Upload artifact # creates zip file with website contents |
| 127 | + # uses: actions/upload-pages-artifact@v3 |
| 128 | + # with: |
| 129 | + # path: . |
| 130 | + # name: github-pages |
| 131 | + # retention-days: 1 |
| 132 | + |
| 133 | + # deploy: # Deployment of web pages to GitHub pages |
| 134 | + # needs: build |
| 135 | + # permissions: |
| 136 | + # pages: write |
| 137 | + # id-token: write |
| 138 | + # environment: |
| 139 | + # name: github-pages |
| 140 | + # url: ${{ steps.deployment.outputs.page_url }} |
| 141 | + # runs-on: ubuntu-latest |
| 142 | + |
| 143 | + # steps: |
| 144 | + # - name: Deploy to GitHub Pages |
| 145 | + # id: deployment |
| 146 | + # uses: actions/deploy-pages@v4 |
| 147 | + # with: |
| 148 | + # token: ${{ secrets.GITHUB_TOKEN }} |
| 149 | + # artifact_name: github-pages |
0 commit comments