This commit is contained in:
@@ -2,7 +2,7 @@ name: Sync public mirror
|
|||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: [ main ] # change if your default branch is different
|
branches: [ main ]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
sync:
|
sync:
|
||||||
@@ -43,10 +43,10 @@ jobs:
|
|||||||
echo "Generating rsync include list from $KEEP_FILE"
|
echo "Generating rsync include list from $KEEP_FILE"
|
||||||
: > "$INCLUDE_FILE"
|
: > "$INCLUDE_FILE"
|
||||||
echo "## Generated from $KEEP_FILE" >> "$INCLUDE_FILE"
|
echo "## Generated from $KEEP_FILE" >> "$INCLUDE_FILE"
|
||||||
echo "+ */" >> "$INCLUDE_FILE" # allow directory traversal
|
echo "+ */" >> "$INCLUDE_FILE"
|
||||||
|
|
||||||
while IFS= read -r line; do
|
while IFS= read -r line; do
|
||||||
line="${line%%#*}" # strip comments
|
line="${line%%#*}"
|
||||||
line="$(echo "$line" | xargs || true)"
|
line="$(echo "$line" | xargs || true)"
|
||||||
[ -z "$line" ] && continue
|
[ -z "$line" ] && continue
|
||||||
case "$line" in
|
case "$line" in
|
||||||
@@ -60,13 +60,13 @@ jobs:
|
|||||||
esac
|
esac
|
||||||
done < "$KEEP_FILE"
|
done < "$KEEP_FILE"
|
||||||
|
|
||||||
echo "- *" >> "$INCLUDE_FILE" # exclude everything else
|
echo "- *" >> "$INCLUDE_FILE"
|
||||||
|
|
||||||
echo "Rsync include rules:"
|
echo "Rsync include rules:"
|
||||||
cat "$INCLUDE_FILE"
|
cat "$INCLUDE_FILE"
|
||||||
|
|
||||||
# Sync only allowed files to the public repo
|
echo "Syncing files to /tmp/public"
|
||||||
rsync -a --delete --prune-empty-dirs \
|
rsync -a --delete --prune-empty-dirs \
|
||||||
|
--exclude '.git/' \
|
||||||
--include-from="$INCLUDE_FILE" \
|
--include-from="$INCLUDE_FILE" \
|
||||||
./ /tmp/public/
|
./ /tmp/public/
|
||||||
|
|
||||||
@@ -76,9 +76,9 @@ jobs:
|
|||||||
|
|
||||||
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..."
|
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
|
||||||
|
|||||||
Reference in New Issue
Block a user