Skip to content

CI

CI #1105

Workflow file for this run

name: CI
on:
push:
pull_request:
workflow_dispatch:
schedule:
- cron: '0 7 * * *'
jobs:
build:
name: πŸ—οΈ Hugo build
runs-on: ubuntu-latest
steps:
- name: πŸ“₯ Check-out
uses: actions/checkout@v4
- name: 🧰 Install Hugo
uses: peaceiris/actions-hugo@v3
with:
hugo-version: '0.123.4'
- name: 🧰 Install dart-sass-embedded
run: sudo snap install dart-sass
- name: 🧰 Install Node
uses: actions/setup-node@v4
with:
node-version: '20.10'
cache: yarn
cache-dependency-path: assets/yarn.lock
- name: 🧰 Install asset dependencies
working-directory: assets/
run: yarn
- name: ♻️ Cache Hugo modules
uses: actions/cache@v4
with:
path: ~/.cache/hugo_cache
key: ${{ runner.os }}-hugo-modules-${{ hashFiles('**/go.sum') }}
restore-keys: ${{ runner.os }}-hugo-modules-
- name: πŸ— Build
run: hugo
env:
HUGO_PARAMS_githubToken: ${{ secrets.GITHUB_TOKEN }}
- name: ♻️ Cache link checker requests
uses: actions/cache@v4
with:
path: .lycheecache
key: link-checker-${{ github.sha }}
restore-keys: link-checker-
- name: πŸ”„ Check links
id: linkCheck
uses: lycheeverse/lychee-action@v1
with:
lycheeVersion: '0.13.0'
args: --require-https --verbose --no-progress --max-concurrency 2 --base public/ --cache --max-cache-age 1d --exclude https://twitter.com/H1iReimer/ --exclude https://linkedin.com/in/heinrichreimer/ --exclude heinrich@reimer.family --accept 999 --max-retries 10 --max-redirects 10 public/
fail: true
- name: πŸ“€ Upload public pages
uses: actions/upload-artifact@v4
with:
name: public-pages
path: public/
if-no-files-found: error
- name: πŸ“€ Upload public pages (for GitHub Pages)
uses: actions/upload-pages-artifact@v3
with:
path: public/
deploy:
name: πŸš€ Deploy
if: |
(github.event_name == 'push' ||
github.event_name == 'workflow_dispatch' ||
github.event_name == 'schedule') &&
(github.ref == 'refs/heads/main' ||
startsWith(github.ref, 'refs/tags'))
needs:
- build
permissions:
pages: write
id-token: write
environment:
name: GitHub Pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: πŸ“₯ Download public pages
uses: actions/download-artifact@v4
with:
name: public-pages
path: public/
- name: πŸš€ Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
release:
name: πŸš€ Create GitHub release
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
needs:
- build
runs-on: ubuntu-latest
steps:
- name: πŸ“₯ Check-out
uses: actions/checkout@v4
- name: 🏷️ Get version tag
id: get-version
run: echo ::set-output name=tag::${GITHUB_REF/refs\/tags\//}
- name: πŸ“₯ Download public pages
uses: actions/download-artifact@v4
with:
name: public-pages
path: public/
- name: πŸ—œοΈ Create public pages archive
run: zip -r public.zip public/
- name: πŸš€ Create GitHub release
uses: softprops/action-gh-release@v2
with:
name: Release ${{ steps.get-version.outputs.tag }}
draft: false
prerelease: false
generate_release_notes: true