Rebuild Site #243
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: Rebuild Site | |
on: | |
workflow_dispatch: | |
inputs: | |
force_generate_all: | |
description: 'Force generate all posts' | |
required: false | |
type: boolean | |
default: true | |
schedule: | |
- cron: '0 11 * * 2' | |
jobs: | |
scheduled: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out this repo | |
uses: actions/checkout@v2 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.9 | |
cache: 'pip' | |
cache-dependency-path: | | |
requirements-build.txt | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install -r requirements-build.txt | |
- name: Download Quarto Package | |
run: wget -O package.deb https://github.com/quarto-dev/quarto-cli/releases/download/v1.3.450/quarto-1.3.450-linux-amd64.deb | |
- name: Install Quarto Package | |
run: | | |
sudo dpkg -i package.deb | |
sudo apt-get install -f | |
- name: Build new site | |
run: | | |
FORCE_FLAG="" | |
if [ ${{ github.event.inputs.force_generate_all }} = true ]; then | |
FORCE_FLAG="--force-generate-all" | |
fi | |
python scripts/generate_qmd.py data/output.jsonl posts $FORCE_FLAG | |
quarto render | |
- name: Commit and push if it changed | |
run: |- | |
git config user.name "Automated" | |
git config user.email "actions@users.noreply.github.com" | |
git add _site/ | |
git add posts/ | |
timestamp=$(date -u) | |
git commit -m "Latest data: ${timestamp}" || exit 0 | |
git push |