Setups directories earlier on to avoid permissions problems by jekyll… #200
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 and deploy website | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
# Adds keys to work with other repositories used in this lesson (e.g., UCL/github-example) | |
- uses: webfactory/[email protected] | |
with: | |
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }} | |
- uses: actions/cache@v4 # FIXME: add apt(latex) | |
with: | |
path: vendor/bundle | |
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile') }} | |
restore-keys: | | |
${{ runner.os }}-gems- | |
- uses: actions/cache@v4 | |
with: | |
path: ~/.cache/pip | |
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt', '.github/python/requirements.txt') }} | |
restore-keys: | | |
${{ runner.os }}-pip- | |
- name: Install TeXLive | |
uses: DanySK/[email protected] | |
- id: setup-python | |
name: Setup Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.12 | |
- name: Install dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get install python3-pydot graphviz | |
python -m pip install -r .github/python/requirements.txt | |
- name: Building notes | |
run: make ready | |
- name: setup directories | |
run: | | |
mkdir contents | |
mkdir -p _site/jupyter-lite # created here so the permissions of the directory don't change | |
- name: Setup Pages | |
uses: actions/configure-pages@v5 | |
- name: Build website | |
uses: actions/jekyll-build-pages@v1 | |
- name: Build the JupyterLite site | |
run: | | |
find . -type d -name .pytest_cache -o -name .ruff_cache -o -name .doctrees | xargs rm -rf | |
find ch*/ -type f -name '*.ipynb' ! -name '*.nbconvert.ipynb' -exec rsync -R {} contents/ \; | |
jupyter lite build --contents contents --output-dir _site/jupyter-lite | |
- name: Upload artifact | |
uses: actions/upload-pages-artifact@v3 | |
deploy: | |
if: > | |
github.ref == 'refs/heads/main' | |
&& github.repository == 'UCL/rsd-engineeringcourse' | |
needs: build | |
permissions: | |
pages: write | |
id-token: write | |
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 |