Files
mehl.mx/.gitea/workflows/hugo.yaml
Max Mehl 0b1d9b0c4d
Some checks failed
Website build and deploy / build (pull_request) Failing after 37s
test: other way
2026-04-01 11:41:09 +02:00

74 lines
2.3 KiB
YAML

name: Website build and deploy
on:
push:
branches:
- main # Deploy branch
# Run on PRs, but only build
pull_request:
# Allows to run this workflow manually from the Actions tab
workflow_dispatch:
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: "pages"
cancel-in-progress: false
jobs:
# Build job
build:
runs-on: ubuntu-latest
steps:
- name: Checkout with submodules
uses: actions/checkout@v6
with:
submodules: recursive # Get submdules
fetch-depth: 1 # Fetch all history for .GitInfo and .Lastmod
- name: Setup required tools (Hugo)
uses: https://github.com/jdx/mise-action@1648a7812b9aeae629881980618f079932869151 # v4.0.1
with:
cache: false # no cache on gitea
github_token: ${{ secrets.GH_TOKEN }}
- name: Create configuration for Matomo
run: |
cp themes/hugo-sustain/static/config.php.sample static/config.php
sed -i "s|__PIWIK_URL__|${{ secrets.MATOMO_PIWIK_URL }}|" static/config.php
sed -i "s|__PROXY_URL__|${{ secrets.MATOMO_PROXY_URL }}|" static/config.php
sed -i "s|__TOKEN_AUTH__|${{ secrets.MATOMO_TOKEN_AUTH }}|" static/config.php
- name: Check for broken links
run: |
if [ "${{ gitea.ref }}" = "refs/heads/main" ]; then
mise linkcheck --offline || true
else
mise linkcheck --offline
fi
- name: Build website with Hugo
run: mise run build
- name: Copy website to host
uses: https://github.com/appleboy/scp-action@ff85246acaad7bdce478db94a363cd2bf7c90345 # v1.0.0
with:
host: mehl.mx
username: maxmehl
key: ${{ secrets.SSH_KEY }}
port: 22
timeout: 1m
command_timeout: 2m
target: "/var/www/virtual/maxmehl/html/"
source: "public/*"
rm: true
strip_components: 1
if: gitea.ref == 'refs/heads/main'