Upgrade actions/setup-python too #76
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
# Adapted from https://github.com/adityatelange/hugo-PaperMod/blob/exampleSite/.github/workflows/gh-pages.yml | |
name: Deploy My Blog to Pages | |
on: | |
push: | |
paths-ignore: | |
- "images/**" | |
- "LICENSE" | |
- "README.md" | |
branches: | |
- main | |
workflow_dispatch: | |
# manual run | |
inputs: | |
hugoVersion: | |
description: "Hugo Version" | |
required: false | |
default: "0.111.3" | |
# Allow one concurrent deployment | |
concurrency: | |
group: "pages" | |
cancel-in-progress: true | |
# Default to bash | |
defaults: | |
run: | |
shell: bash | |
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages | |
permissions: | |
contents: read | |
pages: write | |
id-token: write | |
jobs: | |
# Build job | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
ref: main | |
submodules: recursive | |
# - name: Install Hugo | |
# uses: peaceiris/actions-hugo@v2 | |
# with: | |
# hugo-version: '0.123.8' | |
# extended: true | |
# - name: Install D2 | |
# run: curl -fsSL https://d2lang.com/install.sh | sh -s -- | |
- name: Install Homebrew | |
run: | | |
bash -c "$(curl -fsSL https://github.com/raw/Homebrew/install/HEAD/install.sh)" | |
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)" | |
echo "$(brew --prefix)/bin" >> $GITHUB_PATH | |
- name: Install Hugo, D2, watchexec | |
run: | | |
brew install hugo d2 watchexec | |
- name: Install Quarto | |
uses: quarto-dev/quarto-actions/setup@v2 | |
with: | |
version: 1.4.553 | |
- name: Install Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.11" | |
cache: 'pip' # caching pip dependencies | |
- name: Install Python deps | |
run: | | |
pip install -r requirements.txt | |
- name: Setup Pages | |
id: pages | |
uses: actions/configure-pages@v5 | |
- name: Install Node.js dependencies | |
run: "[[ -f package-lock.json || -f npm-shrinkwrap.json ]] && npm ci || true" | |
- name: Build D2 & Pikchr diagrams, Typst docs | |
run: | | |
bash scripts/make_all.sh | |
- name: Render Quarto Project | |
uses: quarto-dev/quarto-actions/render@v2 | |
- name: Build with Hugo | |
env: | |
# For maximum backward compatibility with Hugo modules | |
HUGO_ENVIRONMENT: production | |
HUGO_ENV: production | |
run: | | |
hugo \ | |
--minify \ | |
--baseURL "${{ steps.pages.outputs.base_url }}/" | |
- name: Fix permissions | |
run: | | |
chmod -c -R +rX "./public/" | while read line; do | |
echo "::warning title=Invalid file permissions automatically fixed::$line" | |
done | |
- name: Upload Pages artifact | |
uses: actions/upload-pages-artifact@v3 | |
with: | |
path: ./public | |
# Deploy job | |
deploy: | |
# Add a dependency to the build job | |
needs: build | |
# Deploy to the github-pages environment | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
# Specify runner + deployment step | |
runs-on: ubuntu-latest | |
steps: | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v4 |