ci: add mirror job to push to GitHub
This commit is contained in:
@@ -187,3 +187,26 @@ jobs:
|
|||||||
${TAGS} \
|
${TAGS} \
|
||||||
.
|
.
|
||||||
# Test 1765481480
|
# Test 1765481480
|
||||||
|
|
||||||
|
mirror:
|
||||||
|
name: Mirror to GitHub
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: [test, lint]
|
||||||
|
if: github.event_name == 'push' && github.ref == 'refs/heads/main' && vars.MIRROR_ENABLED != 'false'
|
||||||
|
container:
|
||||||
|
image: debian:bookworm-slim
|
||||||
|
volumes:
|
||||||
|
- /root/.ssh:/root/.ssh:ro
|
||||||
|
steps:
|
||||||
|
- name: Install git
|
||||||
|
run: apt-get update && apt-get install -y --no-install-recommends git openssh-client ca-certificates && rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
- name: Clone and mirror
|
||||||
|
env:
|
||||||
|
GIT_SSH_COMMAND: "ssh -i /root/.ssh/id_ed25519 -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no"
|
||||||
|
run: |
|
||||||
|
git config --global --add safe.directory "$GITHUB_WORKSPACE"
|
||||||
|
git clone --mirror ${{ env.GITEA_URL }}/${GITHUB_REPOSITORY}.git repo.git
|
||||||
|
cd repo.git
|
||||||
|
git remote add github git@github.com:PlusOne/dbbackup.git
|
||||||
|
git push --mirror github || git push --force --all github && git push --force --tags github
|
||||||
|
|||||||
Reference in New Issue
Block a user