ci-actions/deploy-pages/action.yml
2026-06-06 14:44:53 +01:00

33 lines
1.1 KiB
YAML

name: Deploy to pages mount
description: >-
rsync a built directory into the host /pages mount that nginx serves.
Pure shell — depends on no marketplace actions.
inputs:
source:
description: Source directory whose *contents* are synced (a trailing slash is added automatically).
required: true
target:
description: Subdirectory under /pages to deploy into, e.g. "photos" -> /pages/photos.
required: true
delete:
description: Delete files in the target that are absent from the source ("true"/"false").
default: "true"
runs:
using: composite
steps:
- name: rsync to /pages
shell: bash
env:
SOURCE: ${{ inputs.source }}
TARGET: ${{ inputs.target }}
DELETE: ${{ inputs.delete }}
run: |
set -euo pipefail
command -v rsync >/dev/null 2>&1 || { apt-get update && apt-get install -y --no-install-recommends rsync; }
del=""
[ "$DELETE" = "true" ] && del="--delete"
# Trailing slash on the source => copy its contents, not the dir itself.
src="${SOURCE%/}/"
rsync -a $del --mkpath "$src" "/pages/${TARGET}/"