Skip to content

Commit b1b5705

Browse files
committed
CI/CD: Added mirror workflow to codeberg
1 parent 7d24f3a commit b1b5705

1 file changed

Lines changed: 48 additions & 0 deletions

File tree

.github/workflows/mirror.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: Mirror
2+
3+
on:
4+
push:
5+
workflow_dispatch:
6+
7+
jobs:
8+
9+
mirror-codeberg:
10+
name: Mirror to Codeberg.org
11+
runs-on: ubuntu-latest
12+
steps:
13+
14+
- name: Setup SSH
15+
shell: bash
16+
env:
17+
CODEBERG_SSH_KEY: ${{ secrets.CODEBERG_SSH_KEY }}
18+
CODEBERG_SSH_FINGERPRINT: ${{ vars.CODEBERG_SSH_FINGERPRINT }}
19+
run: |
20+
mkdir ~/.ssh
21+
chmod 0744 ~/.ssh
22+
echo "$CODEBERG_SSH_KEY" > ~/.ssh/id_codeberg
23+
echo "$CODEBERG_SSH_FINGERPRINT" >> ~/.ssh/known_hosts
24+
chmod 0600 ~/.ssh/id_codeberg
25+
chmod 0600 ~/.ssh/known_hosts
26+
27+
- name: Setup Git
28+
shell: bash
29+
run: |
30+
31+
git init --bare .
32+
33+
git config set --append remote.origin.url ${{ github.server_url }}/${{ github.repository }}.git
34+
git config set remote.origin.fetch '+refs/heads/*:refs/heads/*'
35+
git config set --append remote.origin.fetch '+refs/tags/*:refs/tags/*'
36+
git config set remote.origin.mirror true
37+
38+
git config set --append remote.mirrors.url ssh://git@codeberg.org/portablemc/portablemc.git
39+
git config set remote.origin.push '+refs/*:refs/*'
40+
git config set --append remote.origin.push '^refs/pull/*'
41+
git config set remote.mirrors.mirror true
42+
43+
git fetch origin
44+
45+
- name: Mirror Git
46+
shell: bash
47+
run: |
48+
GIT_SSH_COMMAND="ssh -i ~/.ssh/id_codeberg -o IdentitiesOnly=yes" git push --force --mirror mirrors

0 commit comments

Comments
 (0)