aboutsummaryrefslogtreecommitdiffstats
path: root/.github
diff options
context:
space:
mode:
authorJP Dillingham <jp@dillingham.me>2025-12-07 19:26:08 -0600
committerGitHub <noreply@github.com>2025-12-07 19:26:08 -0600
commitae7256b4d6ac9a00600c07af75b3097b4d4f4cbf (patch)
tree2d47fd53fb9951be663e71b1a3071d401dea6683 /.github
parenta73633f5fc421b4f3f14536867aa2f24914cd4c4 (diff)
parent5e5126028ae7cf9a9d4ad87bc24033af69ec8e8e (diff)
downloadslskd-ae7256b4d6ac9a00600c07af75b3097b4d4f4cbf.tar.gz
Merge branch 'master' into add-rev-proxy-instructions
Diffstat (limited to '.github')
-rw-r--r--.github/workflows/mirror.yml66
1 files changed, 66 insertions, 0 deletions
diff --git a/.github/workflows/mirror.yml b/.github/workflows/mirror.yml
new file mode 100644
index 00000000..f3aaa95f
--- /dev/null
+++ b/.github/workflows/mirror.yml
@@ -0,0 +1,66 @@
+name: Mirror Repository
+
+on:
+ create:
+ push:
+ branches:
+ - '**' # Trigger on push to any branch
+ delete:
+ branches:
+ - '**' # Trigger when branches are deleted
+ workflow_dispatch:
+
+concurrency:
+ group: mirror-sync
+ cancel-in-progress: false
+
+jobs:
+ mirror:
+ runs-on: ubuntu-latest
+ strategy:
+ matrix:
+ target:
+ - name: GitLab
+ host: gitlab.com
+ repo: git@gitlab.com:slskd/slskd.git
+ - name: Codeberg
+ host: codeberg.org
+ repo: git@codeberg.org:slskd/slskd.git
+ fail-fast: false # Continue with other mirrors even if one fails
+
+ steps:
+ - name: Configure SSH
+ env:
+ SSH_KEY: ${{ secrets.GIT_MIRROR_SSH_KEY }}
+ run: |
+ if [ -z "$SSH_KEY" ]; then
+ echo "⚠️ SSH key not configured. Skipping mirror sync."
+ echo "Please set GIT_MIRROR_SSH_KEY secret to enable mirroring."
+ exit 1
+ fi
+
+ # Set up SSH key
+ mkdir -p ~/.ssh
+ echo "$SSH_KEY" > ~/.ssh/id_ed25519
+ chmod 600 ~/.ssh/id_ed25519
+
+ # Start SSH agent and add key
+ eval "$(ssh-agent -s)"
+ ssh-add ~/.ssh/id_ed25519
+
+ # Add known host to avoid SSH prompts
+ ssh-keyscan ${{ matrix.target.host }} >> ~/.ssh/known_hosts
+
+ # Configure Git
+ git config --global user.name "GitHub Actions"
+ git config --global user.email "actions@github.com"
+
+ - name: Check out repo
+ run: |
+ git clone --bare https://github.com/slskd/slskd slskd
+
+ - name: Mirror to ${{ matrix.target.name }}
+ working-directory: ./slskd
+ run: |
+ git remote add mirror ${{ matrix.target.repo }}
+ git push --mirror mirror \ No newline at end of file