From a99fa268eaedcc687b1f31b43c08a34fca7e33a0 Mon Sep 17 00:00:00 2001 From: Bausager Date: Mon, 6 Oct 2025 20:48:07 +0200 Subject: [PATCH] Add .gitea/workflows/sync-public.yml --- .gitea/workflows/sync-public.yml | 47 ++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 .gitea/workflows/sync-public.yml diff --git a/.gitea/workflows/sync-public.yml b/.gitea/workflows/sync-public.yml new file mode 100644 index 0000000..1be8e01 --- /dev/null +++ b/.gitea/workflows/sync-public.yml @@ -0,0 +1,47 @@ +name: Sync public mirror +on: + push: + branches: [ main ] # change if your default branch differs + +jobs: + sync: + runs-on: ubuntu-latest + steps: + - name: Checkout private repo + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Install rsync + run: sudo apt-get update && sudo apt-get install -y rsync + + - name: Prepare SSH + env: + SSH_KEY: ${{ secrets.PUBLIC_REPO_SSH_KEY }} + run: | + set -euo pipefail + mkdir -p ~/.ssh + echo "$SSH_KEY" > ~/.ssh/id_sync + chmod 600 ~/.ssh/id_sync + printf 'Host 192.168.1.15\n HostName 192.168.1.15\n Port 22\n User git\n IdentityFile ~/.ssh/id_sync\n IdentitiesOnly yes\n' >> ~/.ssh/config + ssh-keyscan -p 22 192.168.1.15 >> ~/.ssh/known_hosts + + - name: Clone public repo + run: | + set -euo pipefail + git clone --depth 1 "ssh://git@192.168.1.15:22/Bausager/Flux-oss.git" /tmp/public + + - name: Sync files (snapshot) + run: | + set -euo pipefail + rsync -a --delete --exclude '.git' --exclude '.gitea' ./ /tmp/public/ + cd /tmp/public + git config user.name "Gitea CI" + git config user.email "ci@bausager.org" + if ! git diff --quiet; then + git add -A + git commit -m "Sync from Flux (private)" + git push origin HEAD:main + else + echo "No changes to push." + fi