Publish on GitHub pages #1759
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 3 * * */1' | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
env: | |
HUGO_VERSION: 0.140.2 | |
DEPENDENCY_MANAGER: yarn | |
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 apt-get update | |
sudo apt-get remove -y '^dotnet-.*' '^llvm-.*' 'php.*' '^mongodb-.*' '^mysql-.*' '^postgresql-.*' '^gfortran-.*' '^cmake-.*' '^aspnetcore-.*' '^libmono-.*' '^mono-.*' '^ruby.*' '^r-.*' azure-cli powershell | |
sudo rm -rf /usr/local/lib/android /opt/ghc /usr/local/graalvm/ /usr/local/share/powershell /usr/local/lib/android /usr/local/lib/node_modules /usr/local/.ghcup/ /usr/share/dotnet/ | |
sudo apt-get autoremove -y | |
sudo apt-get clean | |
- 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 | |
- uses: actions/checkout@v4 | |
with: | |
submodules: false # Fetch Hugo themes (true OR recursive) | |
- name: Checkout submodules | |
run: | | |
./scripts/github/checkout.sh | |
- 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 Node.js | |
uses: actions/[email protected] | |
with: | |
node-version-file: '.nvmrc' | |
- uses: pnpm/action-setup@v4 | |
with: | |
version: 9 | |
- name: Setup yarn | |
run: npm install -g yarn | |
- name: Generate Files | |
env: | |
SKIP_IIIF: yes | |
run: | | |
./scripts/setup.sh | |
- name: Create IIIF derivates | |
run: | | |
docker run -v ${PWD}:${PWD} ghcr.io/cmahnke/iiif-action:latest-jxl-uploader sh -c "cd ${PWD} && ./scripts/iiif.sh" | |
- 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 | |
- name: Index and cleanup | |
run: | | |
./scripts/post-build.sh | |
- 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 projektemacher.org -a 14 | |
- name: Deploy site | |
uses: peaceiris/[email protected] | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: ./docs | |
force_orphan: true |