Skip to content

Updated theme

Updated theme #307

Workflow file for this run

name: Publish on GitHub pages
on:
push:
branches:
- main
workflow_dispatch:
schedule:
- cron: '30 23 1 * *'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
HUGO_VERSION: 0.136.0
jobs:
deploy:
runs-on: ubuntu-22.04
steps:
# - name: Maximize build space
# uses: easimon/maximize-build-space@master
# with:
# root-reserve-mb: 4096
# temp-reserve-mb: 1096
# remove-android: 'true'
# remove-haskell: 'true'
# remove-codeql: 'true'
# remove-dotnet: 'true'
- name: Free some disk space
run: |
sudo rm -rf /usr/local/lib/android /opt/ghc /opt/hostedtoolcache/CodeQL /usr/local/graalvm/ /usr/local/share/powershell /usr/local/lib/android /usr/local/.ghcup/ /usr/share/dotnet/ /opt/microsoft /usr/local/aws-* /usr/share/miniconda /opt/az /usr/share/kotlinc /usr/share/man /usr/share/sbt /usr/local/julia* /usr/share/az* /usr/share/apache-maven* /usr/share/gradle* /usr/share/swift
df -h
- 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: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Install required dependencies
run: |
./scripts/github-setup.sh
- name: Setup deploy dependencies
env:
DEPLOY_SSH_IDENTITY: ${{ secrets.DEPLOY_SSH_IDENTITY }}
run: |
mkdir -p ~/.ssh && echo "$DEPLOY_SSH_IDENTITY" >> ~/.ssh/known_hosts
- name: Setup Node.js
uses: actions/[email protected]
with:
node-version-file: '.nvmrc'
- name: Generate Files
env:
SKIP_IIIF: yes
SKIP_PDF: yes
NODE_OPTIONS: --openssl-legacy-provider
run: |
./scripts/setup.sh
yarn run clean-build
# - name: Create PDF
# run: |
# python themes/projektemacher-base/scripts/pdf.py
# - name: Create IIIF derivates and upload
# env:
# DEPLOY_SERVER: ${{ secrets.DEPLOY_SERVER }}
# DEPLOY_USER: ${{ secrets.DEPLOY_USER }}
# SSHPASS: ${{ secrets.DEPLOY_PASS }}
# DEPLOY_PATH: ${{ secrets.DEPLOY_PATH }}
# run: docker run -e CHOWN_UID=${UID} -e DEPLOY_SERVER="$DEPLOY_SERVER" -e DEPLOY_USER="$DEPLOY_USER" -e SSHPASS="$SSHPASS" -e DEPLOY_PATH="$DEPLOY_PATH" -e URL_PREFIX="https://static.projektemacher.org/kinderbuecher/" -v ${PWD}:${PWD} ghcr.io/cmahnke/iiif-action:latest-jxl-uploader sh -c "cd ${PWD} && ./scripts/iiif-upload.sh"
- name: Create IIIF derivates
run: |
echo "Running as ${UID}"
docker run -e CHOWN_UID=${UID} -e URL_PREFIX="https://static.projektemacher.org/kinderbuecher/" -v ${PWD}:${PWD} ghcr.io/cmahnke/iiif-action:latest-jxl-uploader sh -c "cd ${PWD} && ./scripts/iiif.sh"
- name: Create PDF
run: |
python themes/projektemacher-base/scripts/pdf.py
- name: Upload
env:
DEPLOY_SERVER: ${{ secrets.DEPLOY_SERVER }}
DEPLOY_USER: ${{ secrets.DEPLOY_USER }}
SSHPASS: ${{ secrets.DEPLOY_PASS }}
DEPLOY_PATH: ${{ secrets.DEPLOY_PATH }}
run: |
cd content
find post -name info.json -exec dirname {} \; > files.lst
find post -name "*.pdf" -exec echo "{}" \; >> files.lst
cat files.lst | xargs chmod 775
# Add this to rsync '--info=progress2' to get a complete progess status
sshpass -e rsync -a --size-only --delete --relative $(cat files.lst) $DEPLOY_USER@$DEPLOY_SERVER:$DEPLOY_PATH/kinderbuecher/
rm -f files.lst
- name: Cleanup
run: |
find content/post/ -name info.json -exec dirname {} \; | xargs -I {} find {} -mindepth 1 -type d -not -path '*/full*' | xargs rm -fr
find content/post/ -name '*.pdf' -exec rm -r {} \;
df -h
# - name: Create and upload PDF
# env:
# DEPLOY_SERVER: ${{ secrets.DEPLOY_SERVER }}
# DEPLOY_USER: ${{ secrets.DEPLOY_USER }}
# SSHPASS: ${{ secrets.DEPLOY_PASS }}
# DEPLOY_PATH: ${{ secrets.DEPLOY_PATH }}
# run: |
# python themes/projektemacher-base/scripts/pdf.py
# cd content
# find post -name "*.pdf" -exec echo "{}" \; > files.lst
# cat files.lst | xargs chmod 775
# sshpass -e rsync -aP --size-only --delete --exclude=*.json --exclude=*.jpg --relative $(cat files.lst) $DEPLOY_USER@$DEPLOY_SERVER:$DEPLOY_PATH/kinderbuecher/
# rm -f files.lst
# cd ..
# find content/post/ -name '*.pdf' -exec rm -r {} \;
#
# - name: Remove PDF
# run: |
# find content/post/ -name '*.pdf' -exec rm -r {} \;
# - name: Create IIIF derivates
# run: docker run -e CHOWN_UID=${UID} -e URL_PREFIX="https://static.projektemacher.org/kinderbuecher/" -v ${PWD}:${PWD} ghcr.io/cmahnke/iiif-action:latest sh -c "cd ${PWD} && ./scripts/iiif.sh"
#
# - name: IIIF directory upload and cleanup
# env:
# DEPLOY_SERVER: ${{ secrets.DEPLOY_SERVER }}
# DEPLOY_USER: ${{ secrets.DEPLOY_USER }}
# SSHPASS: ${{ secrets.DEPLOY_PASS }}
# DEPLOY_PATH: ${{ secrets.DEPLOY_PATH }}
# run: |
# cd content
# find post -name info.json -exec dirname {} \; > files.lst
# cat files.lst | xargs chmod 775
# sshpass -e rsync -aP --size-only --delete --relative $(cat files.lst) $DEPLOY_USER@$DEPLOY_SERVER:$DEPLOY_PATH/kinderbuecher/
# rm -f files.lst
# cd ..
# find content/post/ -name info.json -exec dirname {} \; | xargs rm -r
- name: Setup Hugo
uses: peaceiris/[email protected]
with:
hugo-version: ${{ env.HUGO_VERSION }}
extended: true
- name: Generate stats
run: |
./themes/projektemacher-base/scripts/stat.sh
- name: Build Hugo site
run: hugo --printI18nWarnings --printUnusedTemplates --logLevel=debug
- name: Cleanup Build
run: |
find docs -type f -size +5M -name '*.jpg' -print -exec rm {} \;
find docs -type f -name '*.jxl' -print -exec rm {} \;
find docs -type f -name 'vips-properties.xml' -print -exec rm {} \;
find docs -type f -path '*/full/full/0/default.jpg' -print -exec rm {} \;
- name: Validate JSON
env:
OSTYPE: linux
run: |
yarn run validate
- name: Cleanup disk
run: |
df -h
docker rmi -f ghcr.io/cmahnke/iiif-action:latest-jxl-uploader
rm -rf node_modules
rm -rf content
df -h
- name: Deploy site
uses: peaceiris/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./docs
force_orphan: true