Dedup scripts #72
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@v3 | |
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@v4 | |
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@v3 | |
- name: Install Node.js dependencies | |
run: "[[ -f package-lock.json || -f npm-shrinkwrap.json ]] && npm ci || true" | |
- name: Build D2 diagrams | |
run: | | |
bash scripts/make_d2.sh | |
- name: Build Pikchr diagrams | |
run: | | |
bash scripts/make_pikchr.sh | |
- name: Build Typst docs | |
run: | | |
bash scripts/make_typ.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: Upload artifact | |
uses: actions/upload-pages-artifact@v1 | |
with: | |
path: ./public | |
# Deployment job | |
deploy: | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v1 |