-
Notifications
You must be signed in to change notification settings - Fork 0
33 lines (27 loc) · 862 Bytes
/
Copy pathgitlab-push.yml
File metadata and controls
33 lines (27 loc) · 862 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
name: Mirror to GitLab
on:
push:
branches: ["**"]
tags: ["**"]
workflow_dispatch:
jobs:
mirror:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup SSH
run: |
mkdir -p ~/.ssh
echo "${{ secrets.GITLAB_SSH_KEY }}" > ~/.ssh/id_ed25519
chmod 600 ~/.ssh/id_ed25519
ssh-keyscan -H gitlab.com >> ~/.ssh/known_hosts 2>/dev/null
- name: Add GitLab remote
run: git remote add gitlab git@gitlab.com:cdlus/fmhy.git
- name: Push branches and tags
run: |
export GIT_SSH_COMMAND="ssh -i ~/.ssh/id_ed25519 -o StrictHostKeyChecking=yes"
git fetch --prune origin
git push --prune gitlab "refs/heads/*:refs/heads/*"
git push --prune gitlab "refs/tags/*:refs/tags/*"