-
Notifications
You must be signed in to change notification settings - Fork 104
57 lines (56 loc) · 1.53 KB
/
mirror_repository.yml
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
name: mirror_repository
on:
push:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
env:
MIRROR_REPOSITORY_NAME: AWSIM-mirror
MIRROR_RIPOSITORY: [email protected]:tier4/AWSIM-mirror.git
GIT_NAME: mackierx111
GIT_MAILADDRESS: [email protected]
steps:
- uses: actions/checkout@v2
- name: set-git
run: |
git config --global user.name $GIT_NAME
git config --global user.email $GIT_MAILADDRESS
- name: set-ssh
run: |
mkdir ~/.ssh
chmod 700 ~/.ssh
echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
- name: clone
run: |
mkdir ~/mirror
cd ~/mirror
git clone $MIRROR_RIPOSITORY
echo | ls -l ./
- name: delete
run: |
cd ~/mirror
cd $MIRROR_REPOSITORY_NAME
find . -mindepth 1 -maxdepth 1 ! -name ".git" -exec rm -r "{}" \;
echo | ls -a ./
- name: export
run: |
git archive --format=zip HEAD > ~/original.zip
echo | ls -l ~/original.zip
mkdir ~/original
unzip -o -d ~/$MIRROR_REPOSITORY_NAME ~/original.zip
echo | ls -l ~/$MIRROR_REPOSITORY_NAME
- name: copy
run: |
cp -r ~/$MIRROR_REPOSITORY_NAME ~/mirror
echo | ls -l ~/mirror/$MIRROR_REPOSITORY_NAME
- name: push
run: |
cd ~/mirror/$MIRROR_REPOSITORY_NAME
echo | ls -l
git diff
git add -A
git commit -m "mirror from original"
git push origin main