38 lines
1.0 KiB
YAML
38 lines
1.0 KiB
YAML
name: Deploy static site to pages
|
|
|
|
on:
|
|
push:
|
|
branches: ["main"]
|
|
|
|
jobs:
|
|
deploy:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Deploy to shared pages volume
|
|
run: |
|
|
set -euo pipefail
|
|
|
|
# Gitea/Actions exposes GitHub-compatible env var:
|
|
# GITHUB_REPOSITORY = "Owner/Repo"
|
|
OWNER="$(echo "${GITHUB_REPOSITORY}" | cut -d/ -f1)"
|
|
REPO="$(echo "${GITHUB_REPOSITORY}" | cut -d/ -f2)"
|
|
|
|
TARGET="/target/${OWNER}/${REPO}"
|
|
|
|
echo "Deploying ${GITHUB_REPOSITORY} -> ${TARGET}"
|
|
echo "Using docker volume: gitea_pages_root"
|
|
|
|
docker run --rm \
|
|
-v gitea_pages_root:/target \
|
|
-v "$PWD":/src \
|
|
alpine:3.20 sh -lc '
|
|
apk add --no-cache rsync >/dev/null
|
|
mkdir -p "'"$TARGET"'"
|
|
rsync -av --delete /src/ "'"$TARGET"'"/ \
|
|
--exclude ".git" \
|
|
--exclude ".gitea"
|
|
'
|