cd-stage #336
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
name: cd-stage | |
on: | |
workflow_dispatch: | |
inputs: | |
build_pdf: | |
description: 'build pdf book? (it is increase time workflow)' | |
required: true | |
default: 'no' | |
type: choice | |
options: | |
- 'yes' | |
- 'no' | |
env: | |
PUBLISH_BRANCH: web-page-stage | |
jobs: | |
generate-plantuml-diagrams: | |
runs-on: ubuntu-latest | |
timeout-minutes: 2 | |
steps: | |
- name: checkout to build branch | |
uses: actions/checkout@v3 | |
- name: generate `**.svg` for `**.plantuml` | |
uses: holowinski/plantuml-github-action@main | |
with: | |
args: -v -tsvg **.plantuml | |
- name: push diagrams to runing branch | |
uses: EndBug/add-and-commit@v9.1.1 | |
with: | |
message: auto-generate `**.svg` for `**.plantuml` | |
create-folder-for-latex: | |
runs-on: ubuntu-latest | |
timeout-minutes: 1 | |
steps: | |
- name: checkout to build branch | |
uses: actions/checkout@v3 | |
with: | |
ref: ${{ env.PUBLISH_BRANCH }} | |
- name: create `./latex/` | |
run: | | |
mkdir -p ./latex/ | |
build-and-deploy-book: | |
needs: [generate-plantuml-diagrams, create-folder-for-latex] | |
runs-on: ubuntu-latest | |
timeout-minutes: 10000 | |
environment: | |
name: qmlc-web-page-stage | |
url: https://qmlc-web-page-stage.netlify.app | |
steps: | |
- name: checkout code | |
uses: actions/checkout@v3 | |
- name: setup python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.8' | |
cache: 'pip' | |
- name: install deps | |
run: | | |
pip install --upgrade pip | |
pip install -r requirements.txt | |
- name: build the book | |
id: build_book | |
env: | |
DWAVE_TOKEN: ${{ secrets.DWAVE_TOKEN }} | |
run: | | |
jupyter-book toc migrate ./qmlcourse/_toc.yml -o ./qmlcourse/_toc.yml | |
jupyter-book build ./qmlcourse | |
- name: update publish dir to build branch | |
uses: peaceiris/actions-gh-pages@v3.9.2 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: ./qmlcourse/_build/html/ | |
publish_branch: ${{ env.PUBLISH_BRANCH }} | |
exclude_assets: './qmlcourse/_static/*' | |
- name: build latex files | |
if: github.event.inputs.build_pdf == 'yes' | |
env: | |
DWAVE_TOKEN: ${{ secrets.DWAVE_TOKEN }} | |
run: | | |
sudo apt-get install texlive-latex-extra texlive-fonts-extra texlive-xetex latexmk | |
jupyter-book build ./qmlcourse --builder latex | |
- name: create pdf book | |
if: github.event.inputs.build_pdf == 'yes' | |
continue-on-error: true | |
run: | | |
cd ./qmlcourse/_build/latex/ | |
xelatex -interaction=nonstopmode qmlcourse.tex | |
- name: send pdf book to build branch | |
if: github.event.inputs.build_pdf == 'yes' | |
uses: peaceiris/actions-gh-pages@v3.9.2 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: ./qmlcourse/_build/latex/ | |
destination_dir: ./latex/ | |
publish_branch: ${{ env.PUBLISH_BRANCH }} |