FEAT: update pymechanical cheatsheet (#72) #292
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: Build LaTeX | |
on: | |
pull_request: | |
workflow_dispatch: | |
push: | |
tags: | |
- "*" | |
branches: | |
- main | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
make-pdf: | |
name: Build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python 3.10 | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.10' | |
- name: Install dependencies | |
run: | | |
python -m pip install -r requirements/requirements_doc.txt | |
sudo apt-get update -y | |
sudo apt-get install -y latexmk texlive-fonts-extra | |
sudo apt install graphicsmagick-imagemagick-compat | |
- name: make pdf | |
run: | | |
make all | |
- name: make html | |
run: | | |
make -C doc html | |
- name: "Upload HTML documentation artifact" | |
uses: actions/upload-artifact@v3 | |
with: | |
name: documentation-html | |
path: doc/_build/html | |
retention-days: 7 | |
- name: "Upload PDF artifact" | |
uses: actions/upload-artifact@v3 | |
with: | |
name: cheatsheet-pdf | |
path: _build/*.pdf | |
retention-days: 7 | |
- name: Prepare files for gh-pages deployment | |
if: github.ref == 'refs/heads/main' | |
run: | | |
mkdir build-pdf | |
cp _build/{*.pdf,*.png} build-pdf/ | |
cp -r doc/_build/html/* build-pdf/ | |
- name: Deploy to gh-pages | |
if: github.ref == 'refs/heads/main' | |
uses: JamesIves/[email protected] | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
branch: gh-pages | |
folder: build-pdf | |
clean: true | |
single-commit: true | |
- name: Display logs | |
if: always() | |
run: | | |
echo "::group:: Terminal output 'console_output.txt'" && cat console_output.txt && echo "::endgroup::" | |
for f in _build/*.log; do echo "::group:: Output latex log file $f" && cat $f && echo "::endgroup::" ; done | |
release: | |
name: Release | |
if: github.event_name == 'push' && contains(github.ref, 'refs/tags') | |
needs: [make-pdf] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/download-artifact@v2 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: 3.9 | |
- name: Publish to GitHub | |
uses: softprops/action-gh-release@v1 | |
with: | |
files: | | |
./Cheat-Sheets/*.pdf | |
- name: Release | |
uses: softprops/action-gh-release@v1 | |
with: | |
generate_release_notes: true |