Update .gitea/workflows/sync-public.yml
Sync public mirror / sync (push) Successful in 1m15s

This commit is contained in:
2025-10-06 21:44:43 +02:00
parent 25b8024bf5
commit 9c70ab0966
+9 -28
View File
@@ -1,5 +1,4 @@
name: Sync public mirror name: Sync public mirror
on: on:
push: push:
branches: [ main ] branches: [ main ]
@@ -7,11 +6,11 @@ on:
jobs: jobs:
sync: sync:
runs-on: ubuntu-latest runs-on: ubuntu-latest
container: node:20-alpine
steps: steps:
- name: Install tools (rsync) - name: Install tools
run: | run: apk add --no-cache git rsync openssh-client bash
sudo apt-get update && sudo apt-get install -y rsync
- name: Checkout private repo - name: Checkout private repo
uses: actions/checkout@v4 uses: actions/checkout@v4
@@ -30,41 +29,25 @@ jobs:
ssh-keyscan -p 22 192.168.1.15 >> ~/.ssh/known_hosts ssh-keyscan -p 22 192.168.1.15 >> ~/.ssh/known_hosts
- name: Clone public repo - name: Clone public repo
run: | run: git clone --depth 1 ssh://git@192.168.1.15:22/Bausager/Flux-oss.git /tmp/public
git clone --depth 1 ssh://git@192.168.1.15:22/Bausager/Flux-oss.git /tmp/public
- name: Sync files using .gitea/workflows/oss-keep.txt - name: Sync files using .gitea/workflows/oss-keep.txt
run: | run: |
set -euo pipefail set -euo pipefail
KEEP_FILE=".gitea/workflows/oss-keep.txt" KEEP_FILE=".gitea/workflows/oss-keep.txt"
INCLUDE_FILE="$(pwd)/.oss-include.rsync" INCLUDE_FILE="$(pwd)/.oss-include.rsync"
echo "Generating rsync include list from $KEEP_FILE"
: > "$INCLUDE_FILE" : > "$INCLUDE_FILE"
echo "## Generated from $KEEP_FILE" >> "$INCLUDE_FILE"
echo "+ */" >> "$INCLUDE_FILE" echo "+ */" >> "$INCLUDE_FILE"
while IFS= read -r line; do while IFS= read -r line; do
line="${line%%#*}" line="${line%%#*}"; line="$(echo "$line" | xargs || true)"
line="$(echo "$line" | xargs || true)"
[ -z "$line" ] && continue [ -z "$line" ] && continue
case "$line" in case "$line" in
!*) !*) echo "- ${line#!}";;
pat="${line#!}" *) echo "+ $line";;
echo "- $pat" >> "$INCLUDE_FILE"
;;
*)
echo "+ $line" >> "$INCLUDE_FILE"
;;
esac esac
done < "$KEEP_FILE" done >> "$INCLUDE_FILE"
echo "- *" >> "$INCLUDE_FILE" echo "- *" >> "$INCLUDE_FILE"
echo "Rsync include rules:"
cat "$INCLUDE_FILE"
echo "Syncing files to /tmp/public"
rsync -a --delete --prune-empty-dirs \ rsync -a --delete --prune-empty-dirs \
--exclude '.git/' \ --exclude '.git/' \
--include-from="$INCLUDE_FILE" \ --include-from="$INCLUDE_FILE" \
@@ -73,12 +56,10 @@ jobs:
cd /tmp/public cd /tmp/public
git config user.name "Gitea CI" git config user.name "Gitea CI"
git config user.email "ci@bausager.org" git config user.email "ci@bausager.org"
git add -A git add -A
if git diff --cached --quiet; then if git diff --cached --quiet; then
echo "No public-eligible changes to push." echo "No public-eligible changes to push."
else else
echo "🚀 Pushing filtered subset to Flux-oss..."
git commit -m "Sync public subset from Flux (private)" git commit -m "Sync public subset from Flux (private)"
git push origin HEAD:main git push origin HEAD:main
fi fi