Skip to content

Merge pull request #79 from cmahnke/dependabot/submodules/themes/proj… #484

Merge pull request #79 from cmahnke/dependabot/submodules/themes/proj…

Merge pull request #79 from cmahnke/dependabot/submodules/themes/proj… #484

Workflow file for this run

name: Publish on GitHub pages
on:
push:
branches:
- main
schedule:
- cron: '0 7 * * */5'
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
- 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@v4
with:
python-version: '3.10'
- name: Install required dependencies
run: |
./scripts/github-setup.sh
- name: Setup Node.js
uses: actions/[email protected]
with:
node-version-file: '.nvmrc'
- name: Create IIIF derivates
# UID is als available via $(id -u)
run: |
echo "Running as ${UID}"
docker run -e CHOWN_UID=${UID} -e URL_PREFIX="https://static.projektemacher.org/blaufusstoelpel/" -v ${PWD}:${PWD} ghcr.io/cmahnke/iiif-action:latest-jxl-uploader sh -c "cd ${PWD} && ./scripts/iiif.sh"
- name: Setup deploy env
env:
DEPLOY_SSH_IDENTITY: ${{ secrets.DEPLOY_SSH_IDENTITY }}
run: |
mkdir -p ~/.ssh && echo "$DEPLOY_SSH_IDENTITY" >> ~/.ssh/known_hosts
- 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
cp ../blaufusstoelpel-redirect/index.html .
echo "index.html" >> 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/blaufusstoelpel/
rm -f files.lst index.html
cd ..
find content/post/ -name info.json -exec dirname {} \; | xargs -I {} find {} -mindepth 1 -type d -not -path '*/full*' | xargs rm -rf
#find content/post/ -name info.json -exec dirname {} \; | xargs rm -r
- name: Generate Files
env:
SKIP_IIIF: yes
run: |
./scripts/setup.sh
# - name: Upload IIIF directories
# run: |
# cd ftp
# sshpass -p "$DEPLOY_PASS" rsync --delete -aP * $DEPLOY_USER@$DEPLOY_SERVER:$DEPLOY_PATH
# cd ..
# mkdir ftp
# This needs the packages sshpass ssh-client
# tar cf - * | sshpass -p$DEPLOY_PASS ssh $DEPLOY_USER@$DEPLOY_SERVER "cd $DEPLOY_PATH && rm -rf blaufusstoelpel && mkdir -p blaufusstoelpel && cd blaufusstoelpel && tar xvf - && chmod -R 775 ../blaufusstoelpel"
# This needs the package lftp
# set ftp:ssl-force true; set passive-mode true; set ftp:ssl-protect-data true
# lftp ftp://$DEPLOY_SERVER -u $DEPLOY_USER,$DEPLOY_PASS -e 'set ftp:ssl-force true; set mirror:parallel-directories true; set passive-mode true; set ftp:ssl-protect-data true; mkdir -p blaufusstoelpel; mirror -P 8 -v -R --delete ftp/ blaufusstoelpel/; chmod -Rf 0777 blaufusstoelpel; exit'
- name: Setup Hugo
uses: peaceiris/[email protected]
with:
hugo-version: '0.110.0'
extended: true
- name: Build Hugo site
run: hugo --printI18nWarnings --printUnusedTemplates
- name: Validate JSON
env:
OSTYPE: linux
run: |
yarn run validate
- name: Cleanup Build
run: |
find docs -type f -size +15M -name '*.jpg' -exec rm {} \;
rm -rf docs/plugins
# - name: Cleanup disk
# run: |
# df -h
# docker rmi -f ghcr.io/cmahnke/iiif-action:latest
# du -chs *
# rm -rf node_modules content ftp
# df -h
- name: Puppeteer
run: ./themes/projektemacher-base/scripts/github/check-js-errors.sh
- name: Deploy site
uses: peaceiris/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./docs
force_orphan: true