Publish on GitHub pages #916
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: Publish on GitHub pages | |
on: | |
push: | |
branches: | |
- main | |
workflow_dispatch: | |
schedule: | |
- cron: '30 23 * * *' | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
env: | |
HUGO_VERSION: 0.136.5 | |
jobs: | |
deploy: | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true # Fetch Hugo themes (true OR recursive) | |
- name: Login to GitHub Packages Docker Registry | |
uses: docker/[email protected] | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.CR_PAT }} | |
logout: false | |
- name: Setup Node.js | |
uses: actions/[email protected] | |
with: | |
node-version-file: '.nvmrc' | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.10' | |
- name: Install required dependencies | |
run: | | |
./scripts/github-setup.sh | |
- name: Setup Hugo | |
uses: peaceiris/[email protected] | |
with: | |
hugo-version: ${{ env.HUGO_VERSION }} | |
extended: true | |
- name: Get number of CPU cores | |
uses: SimenB/github-actions-cpu-cores@v2 | |
id: cpu-cores | |
- name: Create IIIF derivates | |
env: | |
CORES: ${{ steps.cpu-cores.outputs.count }} | |
# UID is also available via $(id -u) | |
run: | | |
echo "Running as ${UID}" | |
docker run -e CHOWN_UID=${UID} -e URL_PREFIX="https://labs.projektemacher.org/" -v ${PWD}:${PWD} ghcr.io/cmahnke/iiif-action:latest-jxl-uploader sh -c "cd ${PWD} && ./scripts/iiif.sh" | |
- name: Generate Files | |
env: | |
SKIP_IIIF: yes | |
CORES: ${{ steps.cpu-cores.outputs.count }} | |
run: | | |
./scripts/setup.sh | |
- name: Generate stats | |
run: | | |
./themes/projektemacher-base/scripts/stat.sh | |
- name: Build Hugo site | |
run: hugo --printI18nWarnings --printUnusedTemplates | |
- name: Run post build script | |
run: | | |
./scripts/post-build/qr-codes.sh | |
- name: Validate JSON | |
env: | |
OSTYPE: linux | |
run: | | |
yarn run validate | |
- name: Puppeteer | |
run: ./themes/projektemacher-base/scripts/github/check-js-errors.sh | |
- name: Archive links | |
run: python ./themes/projektemacher-base/scripts/archive.py -d docs/ -e labs.projektemacher.org,projektemacher.org | |
- name: Deploy site | |
uses: peaceiris/[email protected] | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: ./docs | |
force_orphan: true |