mirror of
https://github.com/rehlds/.github.git
synced 2025-02-11 14:18:50 +03:00
gitlab sync matrix
This commit is contained in:
parent
33e1e84801
commit
f77abba43e
43
.github/workflows/sync-with-gitlab.yml
vendored
43
.github/workflows/sync-with-gitlab.yml
vendored
@ -1,31 +1,40 @@
|
|||||||
name: Automatic sync with Gitlab's read-only mirror
|
name: Automatic sync with GitLab's read-only mirror
|
||||||
|
|
||||||
on: [workflow_dispatch, push]
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
schedule:
|
||||||
|
- cron: '42 0 * * 0'
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
mirror:
|
mirror:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
strategy:
|
||||||
- name: Checkout repository
|
matrix:
|
||||||
uses: actions/checkout@v4
|
repo:
|
||||||
|
- {github: "https://github.com/rehlds/.github.git", gitlab: "git@gitlab.com:rehlds/dot-github.git"}
|
||||||
|
- {github: "https://github.com/rehlds/rehlds.git", gitlab: "git@gitlab.com:rehlds/rehlds.git"}
|
||||||
|
|
||||||
- name: Set up SSH key for Runner
|
steps:
|
||||||
|
- name: Set up SSH key
|
||||||
env:
|
env:
|
||||||
SSH_KEY: ${{ secrets.GITLAB_DEPLOY_KEY }}
|
SSH_PRIVATE_KEY: ${{ secrets.GITLAB_DEPLOY_KEY }}
|
||||||
run: |
|
run: |
|
||||||
mkdir -p ~/.ssh
|
mkdir -p ~/.ssh
|
||||||
echo "$SSH_KEY" > ~/.ssh/id_ed25519
|
echo "$SSH_PRIVATE_KEY" > ~/.ssh/id_ed25519
|
||||||
chmod 600 ~/.ssh/id_ed25519
|
chmod 600 ~/.ssh/id_ed25519
|
||||||
ssh-keyscan -t rsa github.com >> ~/.ssh/known_hosts
|
ssh-keyscan -t rsa,ed25519 github.com >> ~/.ssh/known_hosts
|
||||||
ssh-keyscan -t rsa gitlab.com >> ~/.ssh/known_hosts
|
ssh-keyscan -t rsa,ed25519 gitlab.com >> ~/.ssh/known_hosts
|
||||||
|
|
||||||
- name: Clone repository from GitHub as mirror and push to Gitlab
|
- name: Clone repository as mirror
|
||||||
env:
|
run: |
|
||||||
REPO_ORIGINAL: "https://github.com/rehlds/.github.git"
|
git clone --mirror ${{ matrix.repo.github }} repo-mirror
|
||||||
REPO_TARGET: "git@gitlab.com:rehlds/dot-github.git"
|
|
||||||
|
- name: Push to GitLab
|
||||||
run: |
|
run: |
|
||||||
git clone --mirror "$REPO_ORIGINAL" repo-mirror
|
|
||||||
cd repo-mirror
|
cd repo-mirror
|
||||||
git remote set-url origin "$REPO_TARGET"
|
git remote set-url origin ${{ matrix.repo.gitlab }}
|
||||||
git push --mirror --force
|
git push --mirror
|
||||||
|
Loading…
x
Reference in New Issue
Block a user