Files
Workflow config file is invalid. Please check your config file: model.ReadWorkflow: yaml: line 57: mapping values are not allowed in this context

58 lines
1.9 KiB
YAML
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
name: Build & Deploy Website
# Hugo-Projekt. Baut die statische Seite und legt sie in den Webroot
# /var/www/sites/website/ auf 10.161.30.38 (Runner läuft dort). Davor: Nginx Proxy Manager.
on:
push:
branches: [main]
workflow_dispatch: {}
concurrency:
group: deploy-main
cancel-in-progress: true
env:
HUGO_VERSION: "0.148.2"
WEBROOT: /var/www/sites/website
jobs:
deploy:
# Muss zu einem Label deines Gitea-Runners passen. Der Runner MUSS auf dem Host
# laufen (Host-Modus) und Schreibrechte auf ${WEBROOT} haben sonst kommt er
# nicht an den Webroot (Container-Runner sieht das Host-Dateisystem nicht).
runs-on: ubuntu-latest
steps:
- name: Checkout inkl. Git LFS
uses: actions/checkout@v4
with:
lfs: true # ZWINGEND sonst LFS-Pointer statt Bilder/Fonts
fetch-depth: 1
- name: LFS-Dateien holen
run: git lfs pull
- name: Werkzeuge sicherstellen (Hugo extended, rsync)
run: |
set -e
command -v rsync >/dev/null || (apt-get update -qq && apt-get install -yqq rsync ca-certificates curl)
if ! command -v hugo >/dev/null 2>&1 || ! hugo version | grep -q "v${HUGO_VERSION}"; then
curl -fsSL "https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-amd64.tar.gz" -o /tmp/hugo.tgz
tar -xzf /tmp/hugo.tgz -C /usr/local/bin hugo
fi
hugo version
- name: Seite bauen
run: hugo --gc --minify
- name: In den Webroot deployen
run: |
set -e
mkdir -p "${WEBROOT}"
rsync -a --delete public/ "${WEBROOT}/"
echo "Deployt nach ${WEBROOT} ($(find "${WEBROOT}" -type f | wc -l) Dateien)"
- name: Prüfen
run: test -f "${WEBROOT}/index.html" && echo "OK: index.html im Webroot vorhanden"