modified: .gitea/workflows/deploy.yml

This commit is contained in:
Sven Steinert
2026-02-11 12:24:24 +01:00
parent 115de55e13
commit 7dc43bef26

View File

@@ -11,27 +11,35 @@ jobs:
- name: Checkout - name: Checkout
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Deploy to shared pages volume - name: Deploy to shared pages volume (tar stream, no bind mounts)
shell: bash
run: | run: |
set -euo pipefail set -euo pipefail
# Gitea/Actions exposes GitHub-compatible env var:
# GITHUB_REPOSITORY = "Owner/Repo"
OWNER="$(echo "${GITHUB_REPOSITORY}" | cut -d/ -f1)" OWNER="$(echo "${GITHUB_REPOSITORY}" | cut -d/ -f1)"
REPO="$(echo "${GITHUB_REPOSITORY}" | cut -d/ -f2)" REPO="$(echo "${GITHUB_REPOSITORY}" | cut -d/ -f2)"
TARGET="/target/${OWNER}/${REPO}" TARGET="/target/${OWNER}/${REPO}"
echo "Deploying ${GITHUB_REPOSITORY} -> ${TARGET}" echo "Deploying ${GITHUB_REPOSITORY} -> ${TARGET}"
echo "Using docker volume: gitea_pages_root" echo "Files in repo root:"
ls -la
# Create a tar stream of the repo content (excluding VCS + workflow folder)
# and extract it directly into the docker volume via stdin.
tar -czf - \
--exclude=".git" \
--exclude=".gitea" \
. \
| docker run --rm -i \
-v gitea_pages_root:/target \
alpine:3.20 sh -lc '
set -e
mkdir -p "'"$TARGET"'"
rm -rf "'"$TARGET"'/"* "'"$TARGET"'/"..* 2>/dev/null || true
tar -xzf - -C "'"$TARGET"'"
'
echo "Deployed. Listing target:"
docker run --rm \ docker run --rm \
-v gitea_pages_root:/target \ -v gitea_pages_root:/target \
-v "$PWD":/src \ alpine:3.20 sh -lc 'ls -la "'"$TARGET"'" | sed -n "1,50p"'
alpine:3.20 sh -lc '
apk add --no-cache rsync >/dev/null
mkdir -p "'"$TARGET"'"
rsync -av --delete /src/ "'"$TARGET"'"/ \
--exclude ".git" \
--exclude ".gitea"
'