diff --git a/.gitea/workflows/sync-to-svn.yaml b/.gitea/workflows/sync-to-svn.yaml index 2f715ab..8bdead0 100644 --- a/.gitea/workflows/sync-to-svn.yaml +++ b/.gitea/workflows/sync-to-svn.yaml @@ -8,7 +8,10 @@ # SVN_REPO_URL – Base SVN repo URL (e.g. https://svn.example.com/repos/myproject) name: Sync to SVN -on: [push] +on: + push: + branches: + - master jobs: push-to-svn: @@ -51,3 +54,24 @@ jobs: --exclude='.svn/' \ --exclude='svn-branch/' \ . svn-branch/ + - name: Stage and commit to SVN + run: | + cd svn-branch + + # Add all new/unversioned files and directories in one pass + svn add --force . + + # Delete files removed from git (handles paths with spaces). + # '|| true' prevents pipefail aborting when grep finds no '!' lines. + svn status | grep '^!' | while IFS= read -r line; do + svn delete "${line:8}@" + done || true + + # Attempt commit; svn commit exits 0 silently when nothing changed + svn commit \ + --username "${{ secrets.SVN_USERNAME }}" \ + --password "${{ secrets.SVN_PASSWORD }}" \ + --no-auth-cache \ + --non-interactive \ + --trust-server-cert \ + -m "Gitea CI sync from commit ${{ github.sha }} [ci skip]" \ No newline at end of file