fmartingr.com/.github/workflows/deploy.yml
butterrobot e872342c86
All checks were successful
Build and deploy / build-and-deploy (push) Successful in 1m2s
FMG-7: migrate deploy pipeline from Woodpecker to Forgejo Actions (#3)
Replaces .woodpecker/deploy.yml with .github/workflows/deploy.yml. Same shape as before: build with Hugo, then rsync public/ to the web host over SSH using the existing SSH_HOST / SSH_USER / SSH_PATH / SSH_PRIVATE_KEY secrets (re-add them as Actions secrets). The hand-rolled SSH setup is replaced by actions/ssh-deploy-action; the Woodpecker 'Daily build' cron becomes a schedule: trigger at 04:00 UTC, plus workflow_dispatch. Hugo is installed from a pinned, checksum-verified extended release because ci-base does not ship it and the theme transpiles Sass.

Reviewed-on: #3
2026-09-09 19:04:35 +02:00

59 lines
2 KiB
YAML

name: Build and deploy
on:
push:
branches: [master]
pull_request:
branches: [master]
schedule:
# Daily rebuild so posts dated in the future get published on time.
- cron: '0 4 * * *'
workflow_dispatch:
jobs:
build-and-deploy:
runs-on: docker
container: git.nakama.town/fmartingr/ci-images/ci-base:1.1.0
steps:
- uses: actions/checkout@v7
# Hugo Modules resolve github.com/hugomods/images through the Go toolchain.
- uses: actions/setup-go@v7
with:
go-version-file: go.mod
- name: Install Hugo
env:
HUGO_VERSION: '0.165.0'
HUGO_SHA256_AMD64: f43494894cdf4a8630a201d5c828051c77f523cc66bb3938b30806835470ac20
HUGO_SHA256_ARM64: f40ebc44dfda3896cecd3ae7ed44f5c44c4b4a30a2b7d976ece6da62da699a58
run: |
set -eu
case "$(uname -m)" in
x86_64) arch=amd64; checksum="$HUGO_SHA256_AMD64" ;;
aarch64) arch=arm64; checksum="$HUGO_SHA256_ARM64" ;;
*) echo "Unsupported architecture: $(uname -m)" >&2; exit 1 ;;
esac
# The theme transpiles Sass, which only the extended build ships.
curl -fsSL -o hugo.tar.gz \
"https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-${arch}.tar.gz"
echo "${checksum} hugo.tar.gz" | sha256sum -c -
tar -xzf hugo.tar.gz hugo
install -m 0755 hugo /usr/local/bin/hugo
rm -f hugo hugo.tar.gz
hugo version
# Runs on every pull request too, so a broken build is caught before merge.
- name: Build site
run: hugo --gc --minify
- name: Deploy
if: github.event_name != 'pull_request'
uses: actions/ssh-deploy-action@main
with:
host: ${{ secrets.SSH_HOST }}
username: ${{ secrets.SSH_USER }}
key: ${{ secrets.SSH_PRIVATE_KEY }}
source: public
target: ${{ secrets.SSH_PATH }}
args: --delete