Skip to content

Closing file in solution for compute average from file. #267

Closing file in solution for compute average from file.

Closing file in solution for compute average from file. #267

# Validate the file using e.g.
# https://rhysd.github.io/actionlint/
# There *could* be a point to be made that
# this workflow could be divided in two, cf.
# https://stackoverflow.com/q/69316044
# for instance (one to build, one to deploy).
# However, since we will always build and
# deploy, and since it introduces additional
# complications (detailed below), we prefer to
# keep the jobs in the same workflow.
name: Build & deploy
permissions:
contents: write
pages: write
id-token: write
on:
push:
branches: [ main ]
paths:
- 'source/**'
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version: 20
- uses: chetan/git-restore-mtime-action@v2
- name: Cache 💾
uses: actions/cache@v4
with:
path: |
~/.cache
pandoc-3.5-1-amd64.deb
key: ${{ runner.os }}-pip-
restore-keys: ${{ runner.os }}-pip-
- name: Setup Python 🐍
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Setup pandoc ⚙️
run: |
sudo apt-get update
test -f pandoc-3.5-1-amd64.deb || wget https://github.com/jgm/pandoc/releases/download/3.5/pandoc-3.5-1-amd64.deb
sudo dpkg -i pandoc-3.5-1-amd64.deb
sudo apt-get install -y texlive texlive-xetex texlive-latex-extra lmodern librsvg2-bin fonts-symbola pdf2svg
pip install --upgrade pip
pip install Pygments pandoc-include
- name: Setup mermaid-filter
run: |
npm install --global mermaid-filter
- name: Fetch previous version ⤵️ # <- To save some compilation time, we download the last release and unzip it. We also synchronize the project files back in the source/ folder, to gain some time.
run: |
cd /home/runner/work/princomp.github.io/princomp.github.io/source/
make fetch
- name: Build 🏗️
run: |
cd /home/runner/work/princomp.github.io/princomp.github.io/source/
make -l 4.5 -j$(nproc --ignore=2) all
- name: Create package 🎁
uses: crowbarmaster/GH-Automatic-Releases@latest
with:
automatic_release_tag: "latest"
repo_token: ${{ secrets.GITHUB_TOKEN }}
prerelease: true
draft: false
files: content/release.zip
- name: Switching to quartz 🪴
run: git checkout quartz # <- This part is a bit tricky. We built the content/ folder previously, and since it is not tracked by github, this folder stays even if we change branch.
# If we had two different workflow, we would need to re-download the package created previously before being able to deploy the website.
- name: Install Dependencies
run: npm ci
- name: Build Quartz
run: npx quartz build
- name: Upload artifact
uses: actions/upload-pages-artifact@v3.0.1
with:
path: public
deploy:
needs: build
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