|
| 1 | +# SPDX-License-Identifier: PMPL-1.0-or-later |
| 2 | +# SPDX-FileCopyrightText: 2026 Jonathan D.A. Jewell |
| 3 | +name: Mirror to Git Forges |
| 4 | + |
| 5 | +on: |
| 6 | + push: |
| 7 | + branches: [main] |
| 8 | + workflow_dispatch: |
| 9 | + |
| 10 | +permissions: read-all |
| 11 | + |
| 12 | +jobs: |
| 13 | + mirror-gitlab: |
| 14 | + runs-on: ubuntu-latest |
| 15 | + if: vars.GITLAB_MIRROR_ENABLED == 'true' |
| 16 | + steps: |
| 17 | + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 |
| 18 | + with: |
| 19 | + fetch-depth: 0 |
| 20 | + |
| 21 | + - uses: webfactory/ssh-agent@a6f90b1f127823b31d4d4a8d96047790581349bd # v0.9.1 |
| 22 | + with: |
| 23 | + ssh-private-key: ${{ secrets.GITLAB_SSH_KEY }} |
| 24 | + |
| 25 | + - name: Mirror to GitLab |
| 26 | + run: | |
| 27 | + ssh-keyscan -t ed25519 gitlab.com >> ~/.ssh/known_hosts |
| 28 | + git remote add gitlab git@gitlab.com:${{ vars.GITLAB_ORG || vars.MIRROR_ORG || github.repository_owner }}/${{ github.event.repository.name }}.git || true |
| 29 | + git push --force gitlab main |
| 30 | +
|
| 31 | + mirror-bitbucket: |
| 32 | + runs-on: ubuntu-latest |
| 33 | + if: vars.BITBUCKET_MIRROR_ENABLED == 'true' |
| 34 | + steps: |
| 35 | + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 |
| 36 | + with: |
| 37 | + fetch-depth: 0 |
| 38 | + |
| 39 | + - uses: webfactory/ssh-agent@a6f90b1f127823b31d4d4a8d96047790581349bd # v0.9.1 |
| 40 | + with: |
| 41 | + ssh-private-key: ${{ secrets.BITBUCKET_SSH_KEY }} |
| 42 | + |
| 43 | + - name: Mirror to Bitbucket |
| 44 | + run: | |
| 45 | + ssh-keyscan -t ed25519 bitbucket.org >> ~/.ssh/known_hosts |
| 46 | + git remote add bitbucket git@bitbucket.org:${{ vars.BITBUCKET_ORG || vars.MIRROR_ORG || github.repository_owner }}/${{ github.event.repository.name }}.git || true |
| 47 | + git push --force bitbucket main |
| 48 | +
|
| 49 | + mirror-codeberg: |
| 50 | + runs-on: ubuntu-latest |
| 51 | + if: vars.CODEBERG_MIRROR_ENABLED == 'true' |
| 52 | + steps: |
| 53 | + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 |
| 54 | + with: |
| 55 | + fetch-depth: 0 |
| 56 | + |
| 57 | + - uses: webfactory/ssh-agent@a6f90b1f127823b31d4d4a8d96047790581349bd # v0.9.1 |
| 58 | + with: |
| 59 | + ssh-private-key: ${{ secrets.CODEBERG_SSH_KEY }} |
| 60 | + |
| 61 | + - name: Mirror to Codeberg |
| 62 | + run: | |
| 63 | + ssh-keyscan -t ed25519 codeberg.org >> ~/.ssh/known_hosts |
| 64 | + git remote add codeberg git@codeberg.org:${{ vars.CODEBERG_ORG || vars.MIRROR_ORG || github.repository_owner }}/${{ github.event.repository.name }}.git || true |
| 65 | + git push --force codeberg main |
| 66 | +
|
| 67 | + mirror-sourcehut: |
| 68 | + runs-on: ubuntu-latest |
| 69 | + if: vars.SOURCEHUT_MIRROR_ENABLED == 'true' |
| 70 | + steps: |
| 71 | + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 |
| 72 | + with: |
| 73 | + fetch-depth: 0 |
| 74 | + |
| 75 | + - uses: webfactory/ssh-agent@a6f90b1f127823b31d4d4a8d96047790581349bd # v0.9.1 |
| 76 | + with: |
| 77 | + ssh-private-key: ${{ secrets.SOURCEHUT_SSH_KEY }} |
| 78 | + |
| 79 | + - name: Mirror to SourceHut |
| 80 | + run: | |
| 81 | + ssh-keyscan -t ed25519 git.sr.ht >> ~/.ssh/known_hosts |
| 82 | + git remote add sourcehut git@git.sr.ht:~${{ vars.SOURCEHUT_ORG || vars.MIRROR_ORG || github.repository_owner }}/${{ github.event.repository.name }} || true |
| 83 | + git push --force sourcehut main |
| 84 | +
|
| 85 | + mirror-disroot: |
| 86 | + runs-on: ubuntu-latest |
| 87 | + if: vars.DISROOT_MIRROR_ENABLED == 'true' |
| 88 | + steps: |
| 89 | + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 |
| 90 | + with: |
| 91 | + fetch-depth: 0 |
| 92 | + |
| 93 | + - uses: webfactory/ssh-agent@a6f90b1f127823b31d4d4a8d96047790581349bd # v0.9.1 |
| 94 | + with: |
| 95 | + ssh-private-key: ${{ secrets.DISROOT_SSH_KEY }} |
| 96 | + |
| 97 | + - name: Mirror to Disroot |
| 98 | + run: | |
| 99 | + ssh-keyscan -t ed25519 git.disroot.org >> ~/.ssh/known_hosts |
| 100 | + git remote add disroot git@git.disroot.org:${{ vars.DISROOT_ORG || vars.MIRROR_ORG || github.repository_owner }}/${{ github.event.repository.name }}.git || true |
| 101 | + git push --force disroot main |
| 102 | +
|
| 103 | + mirror-gitea: |
| 104 | + runs-on: ubuntu-latest |
| 105 | + if: vars.GITEA_MIRROR_ENABLED == 'true' |
| 106 | + steps: |
| 107 | + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 |
| 108 | + with: |
| 109 | + fetch-depth: 0 |
| 110 | + |
| 111 | + - uses: webfactory/ssh-agent@a6f90b1f127823b31d4d4a8d96047790581349bd # v0.9.1 |
| 112 | + with: |
| 113 | + ssh-private-key: ${{ secrets.GITEA_SSH_KEY }} |
| 114 | + |
| 115 | + - name: Mirror to Gitea |
| 116 | + run: | |
| 117 | + ssh-keyscan -t ed25519 ${{ vars.GITEA_HOST }} >> ~/.ssh/known_hosts |
| 118 | + git remote add gitea git@${{ vars.GITEA_HOST }}:${{ vars.GITEA_ORG || vars.MIRROR_ORG || github.repository_owner }}/${{ github.event.repository.name }}.git || true |
| 119 | + git push --force gitea main |
| 120 | +
|
| 121 | + mirror-radicle: |
| 122 | + runs-on: ubuntu-latest |
| 123 | + if: vars.RADICLE_MIRROR_ENABLED == 'true' |
| 124 | + steps: |
| 125 | + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 |
| 126 | + with: |
| 127 | + fetch-depth: 0 |
| 128 | + |
| 129 | + - name: Setup Rust |
| 130 | + uses: dtolnay/rust-toolchain@efa25f7f19611383d5b0ccf2d1c8914531636bf9 # stable |
| 131 | + with: |
| 132 | + toolchain: stable |
| 133 | + |
| 134 | + - name: Install Radicle |
| 135 | + run: | |
| 136 | + # Install via cargo (safer than curl|sh) |
| 137 | + cargo install radicle-cli --locked |
| 138 | + echo "$HOME/.cargo/bin" >> $GITHUB_PATH |
| 139 | +
|
| 140 | + - name: Mirror to Radicle |
| 141 | + run: | |
| 142 | + echo "${{ secrets.RADICLE_KEY }}" > ~/.radicle/keys/radicle |
| 143 | + chmod 600 ~/.radicle/keys/radicle |
| 144 | + rad sync --announce || echo "Radicle sync attempted" |
0 commit comments