Skip to content

Commit 4b872d3

Browse files
committed
chore: update mirror workflow for multi-forge sync
1 parent 4f74bce commit 4b872d3

1 file changed

Lines changed: 116 additions & 26 deletions

File tree

.github/workflows/mirror.yml

Lines changed: 116 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,138 @@
1-
name: Mirror to GitLab and Bitbucket
2-
permissions: read-all
1+
# SPDX-License-Identifier: AGPL-3.0-or-later
2+
# SPDX-FileCopyrightText: 2025 Jonathan D.A. Jewell
3+
name: Mirror to Git Forges
34

45
on:
56
push:
6-
branches: [main, master]
7-
tags:
8-
- 'v*'
7+
branches: [main]
98
workflow_dispatch:
109

10+
permissions: read-all
11+
1112
jobs:
1213
mirror-gitlab:
1314
runs-on: ubuntu-latest
14-
if: ${{ vars.GITLAB_MIRROR_ENABLED == 'true' }}
15-
15+
if: vars.GITLAB_MIRROR_ENABLED == 'true'
1616
steps:
17-
- name: Checkout
18-
uses: actions/checkout@v6
17+
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
1918
with:
2019
fetch-depth: 0
2120

22-
- name: Push to GitLab
23-
env:
24-
GITLAB_TOKEN: ${{ secrets.GITLAB_TOKEN }}
25-
REPO_NAME: ${{ github.event.repository.name }}
21+
- uses: webfactory/ssh-agent@dc588b651fe13675774614f8e6a936a468676387 # v0.9.0
22+
with:
23+
ssh-private-key: ${{ secrets.GITLAB_SSH_KEY }}
24+
25+
- name: Mirror to GitLab
2626
run: |
27-
git remote add gitlab https://oauth2:${GITLAB_TOKEN}@gitlab.com/hyperpolymath/${REPO_NAME}.git || true
28-
git push gitlab HEAD:main --force || git push gitlab HEAD:master --force
29-
git push gitlab --tags --force
27+
ssh-keyscan -t ed25519 gitlab.com >> ~/.ssh/known_hosts
28+
git remote add gitlab git@gitlab.com:hyperpolymath/${{ github.event.repository.name }}.git || true
29+
git push --force gitlab main
3030
3131
mirror-bitbucket:
3232
runs-on: ubuntu-latest
33-
if: ${{ vars.BITBUCKET_MIRROR_ENABLED == 'true' }}
33+
if: vars.BITBUCKET_MIRROR_ENABLED == 'true'
34+
steps:
35+
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
36+
with:
37+
fetch-depth: 0
38+
39+
- uses: webfactory/ssh-agent@dc588b651fe13675774614f8e6a936a468676387 # v0.9.0
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: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 git@codeberg.org: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 git@git.sr.ht:~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 git@git.disroot.org: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
34110

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'
35124
steps:
36-
- name: Checkout
37-
uses: actions/checkout@v6
125+
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
38126
with:
39127
fetch-depth: 0
40128

41-
- name: Push to Bitbucket
42-
env:
43-
BITBUCKET_TOKEN: ${{ secrets.BITBUCKET_TOKEN }}
44-
REPO_NAME: ${{ github.event.repository.name }}
129+
- name: Install Radicle
130+
run: |
131+
curl -sSf https://radicle.xyz/install | sh
132+
echo "$HOME/.radicle/bin" >> $GITHUB_PATH
133+
134+
- name: Mirror to Radicle
45135
run: |
46-
git remote add bitbucket https://x-token-auth:${BITBUCKET_TOKEN}@bitbucket.org/hyperpolymath/${REPO_NAME}.git || true
47-
git push bitbucket HEAD:main --force || git push bitbucket HEAD:master --force
48-
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

Comments
 (0)