CI #1041
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: 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@v2 | |
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 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@master | |
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 |