Skip to content

CPU-zero not in course for now #227

CPU-zero not in course for now

CPU-zero not in course for now #227

Workflow file for this run

name: ci
on:
push:
branches:
- master
- main
tags:
- "*"
permissions:
contents: write
jobs:
build:
name: Build MkDocs Documentation
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Configure Git Credentials
env:
GH_TOKEN: ${{ secrets.MKDOCS_MATERIALS_INSIDER_PAT }}
run: |
git config user.name github-actions[bot]
git config user.email github-actions[bot]@users.noreply.github.com
git config --global url."https://${GH_TOKEN}@github.com/".insteadOf "[email protected]:"
- uses: actions/setup-python@v5
with:
python-version: 3.x
- name: Cache Poetry dependencies
uses: actions/cache@v4
with:
path: |
~/.cache/pypoetry
~/.venv
key: ${{ runner.os }}-poetry-${{ hashFiles('**/poetry.lock') }}
restore-keys: |
${{ runner.os }}-poetry-
- name: Install Ubuntu dependencies
run: |
sudo apt-get update
sudo apt install -y pngquant ghostscript
- uses: abatilo/actions-poetry@v2
- run: poetry install
- name: Cache MkDocs build directory
uses: actions/cache@v4
with:
path: ./build
key: ${{ runner.os }}-mkdocs-build-${{ hashFiles('docs/**/*.md', 'mkdocs.yml') }}
restore-keys: |
${{ runner.os }}-mkdocs-build-
- name: Build Documentation with MkDocs
env:
MKDOCS_GIT_COMMITTERS_APIKEY: ${{ secrets.MKDOCS_GIT_COMMITTERS_APIKEY }}
GH_TOKEN: ${{ secrets.MKDOCS_GIT_COMMITTERS_APIKEY }}
run: CI=true poetry run mkdocs gh-deploy --force
- name: Upload Build Artifacts
uses: actions/upload-artifact@v4
with:
name: latex
path: ./build
book:
name: Build LaTeX Book
needs:
- build
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Download Build Artifacts
uses: actions/download-artifact@v4
with:
name: latex
path: ./build
- name: Cache Docker layers
uses: actions/cache@v4
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-docker-${{ hashFiles('Dockerfile') }}
restore-keys: |
${{ runner.os }}-docker-
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
with:
install: true
driver: "docker-container"
buildkitd-flags: --oci-worker=true --oci-worker-gc=false
- name: Build Docker image
run: |
docker buildx build --cache-from=type=local,src=/tmp/.buildx-cache \
--cache-to=type=local,dest=/tmp/.buildx-cache \
--load \
-t latex-ycr:latest .
- name: Build LaTeX Book (using Docker)
run: make ci
- name: Upload PDF Artifact
uses: actions/upload-artifact@v4
with:
name: PDF
path: build/*/output-print.pdf
if-no-files-found: ignore
release:
name: Create GitHub Release
if: startsWith(github.ref, 'refs/tags/')
needs: book
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Download PDF Artifact
uses: actions/download-artifact@v4
with:
name: PDF
path: ./build
- name: Rename PDF file
run: |
mv ./build/book/output-print.pdf ./build/handbook.pdf
mv ./build/tools/output-print.pdf ./build/devtools.pdf
- name: Create GitHub Release
id: create_release
uses: actions/create-release@v1
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: false
body: "Release notes"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload Handbook PDF
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./build/handbook.pdf
asset_name: handbook.pdf
asset_content_type: application/pdf
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload Devtools PDF
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./build/devtools.pdf
asset_name: devtools.pdf
asset_content_type: application/pdf
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}