|
1 | 1 | # SPDX-License-Identifier: AGPL-3.0-or-later |
2 | | -name: Mirror to GitLab and Bitbucket |
| 2 | +# SPDX-FileCopyrightText: 2025 Jonathan D.A. Jewell |
| 3 | +name: Mirror to Git Forges |
3 | 4 |
|
4 | 5 | on: |
5 | 6 | push: |
6 | | - branches: [main, master] |
7 | | - tags: |
8 | | - - 'v*' |
| 7 | + branches: [main] |
9 | 8 | workflow_dispatch: |
10 | 9 |
|
11 | 10 | permissions: read-all |
12 | 11 |
|
13 | 12 | jobs: |
14 | 13 | mirror-gitlab: |
15 | 14 | runs-on: ubuntu-latest |
16 | | - permissions: |
17 | | - contents: read |
18 | | - if: ${{ vars.GITLAB_MIRROR_ENABLED == 'true' }} |
19 | | - |
| 15 | + if: vars.GITLAB_MIRROR_ENABLED == 'true' |
20 | 16 | steps: |
21 | | - - name: Checkout |
22 | | - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 |
| 17 | + - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4 |
23 | 18 | with: |
24 | 19 | fetch-depth: 0 |
25 | 20 |
|
26 | | - - name: Setup SSH |
27 | | - uses: webfactory/ssh-agent@a6f90b1f127823b31d4d4a8d96047790581349bd # v0.9.1 |
| 21 | + - uses: webfactory/ssh-agent@dc588b651fe13675774614f8e6a936a468676387 # v0.9.0 |
28 | 22 | with: |
29 | 23 | ssh-private-key: ${{ secrets.GITLAB_SSH_KEY }} |
30 | 24 |
|
31 | | - - name: Add GitLab to known hosts |
| 25 | + - name: Mirror to GitLab |
32 | 26 | run: | |
33 | | - mkdir -p ~/.ssh |
34 | 27 | ssh-keyscan -t ed25519 gitlab.com >> ~/.ssh/known_hosts |
35 | | -
|
36 | | - - name: Push to GitLab |
37 | | - env: |
38 | | - REPO_NAME: ${{ github.event.repository.name }} |
39 | | - run: | |
40 | | - git remote add gitlab [email protected]:hyperpolymath/${REPO_NAME}.git || true |
41 | | - git push gitlab HEAD:main --force || git push gitlab HEAD:master --force |
42 | | - git push gitlab --tags --force |
| 28 | + git remote add gitlab [email protected]:hyperpolymath/${{ github.event.repository.name }}.git || true |
| 29 | + git push --force gitlab main |
43 | 30 |
|
44 | 31 | mirror-bitbucket: |
45 | 32 | runs-on: ubuntu-latest |
46 | | - permissions: |
47 | | - contents: read |
48 | | - if: ${{ vars.BITBUCKET_MIRROR_ENABLED == 'true' }} |
49 | | - |
| 33 | + if: vars.BITBUCKET_MIRROR_ENABLED == 'true' |
50 | 34 | steps: |
51 | | - - name: Checkout |
52 | | - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 |
| 35 | + - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4 |
53 | 36 | with: |
54 | 37 | fetch-depth: 0 |
55 | 38 |
|
56 | | - - name: Setup SSH |
57 | | - uses: webfactory/ssh-agent@a6f90b1f127823b31d4d4a8d96047790581349bd # v0.9.1 |
| 39 | + - uses: webfactory/ssh-agent@dc588b651fe13675774614f8e6a936a468676387 # v0.9.0 |
58 | 40 | with: |
59 | 41 | ssh-private-key: ${{ secrets.BITBUCKET_SSH_KEY }} |
60 | 42 |
|
61 | | - - name: Add Bitbucket to known hosts |
| 43 | + - name: Mirror to Bitbucket |
62 | 44 | run: | |
63 | | - mkdir -p ~/.ssh |
64 | 45 | ssh-keyscan -t ed25519 bitbucket.org >> ~/.ssh/known_hosts |
| 46 | + git remote add bitbucket [email protected]:hyperpolymath/${{ 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@b4ffde65f46336ab88eb53be808477a3936bae11 # v4 |
| 54 | + with: |
| 55 | + fetch-depth: 0 |
| 56 | + |
| 57 | + - uses: webfactory/ssh-agent@dc588b651fe13675774614f8e6a936a468676387 # v0.9.0 |
| 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 [email protected]:hyperpolymath/${{ 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@b4ffde65f46336ab88eb53be808477a3936bae11 # v4 |
| 72 | + with: |
| 73 | + fetch-depth: 0 |
| 74 | + |
| 75 | + - uses: webfactory/ssh-agent@dc588b651fe13675774614f8e6a936a468676387 # v0.9.0 |
| 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 [email protected]:~hyperpolymath/${{ 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@b4ffde65f46336ab88eb53be808477a3936bae11 # v4 |
| 90 | + with: |
| 91 | + fetch-depth: 0 |
| 92 | + |
| 93 | + - uses: webfactory/ssh-agent@dc588b651fe13675774614f8e6a936a468676387 # v0.9.0 |
| 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 [email protected]:hyperpolymath/${{ 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@b4ffde65f46336ab88eb53be808477a3936bae11 # v4 |
| 108 | + with: |
| 109 | + fetch-depth: 0 |
| 110 | + |
| 111 | + - uses: webfactory/ssh-agent@dc588b651fe13675774614f8e6a936a468676387 # v0.9.0 |
| 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 }}:hyperpolymath/${{ 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@b4ffde65f46336ab88eb53be808477a3936bae11 # v4 |
| 126 | + with: |
| 127 | + fetch-depth: 0 |
| 128 | + |
| 129 | + - name: Install Radicle |
| 130 | + run: | |
| 131 | + curl -sSf https://radicle.xyz/install | sh |
| 132 | + echo "$HOME/.radicle/bin" >> $GITHUB_PATH |
65 | 133 |
|
66 | | - - name: Push to Bitbucket |
67 | | - env: |
68 | | - REPO_NAME: ${{ github.event.repository.name }} |
| 134 | + - name: Mirror to Radicle |
69 | 135 | run: | |
70 | | - git remote add bitbucket [email protected]:hyperpolymath/${REPO_NAME}.git || true |
71 | | - git push bitbucket HEAD:main --force || git push bitbucket HEAD:master --force |
72 | | - git push bitbucket --tags --force |
| 136 | + echo "${{ secrets.RADICLE_KEY }}" > ~/.radicle/keys/radicle |
| 137 | + chmod 600 ~/.radicle/keys/radicle |
| 138 | + rad sync --announce || echo "Radicle sync attempted" |
0 commit comments