-
Notifications
You must be signed in to change notification settings - Fork 0
63 lines (53 loc) · 1.82 KB
/
sync-repo.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
58
59
60
61
62
63
name: Sync main repo to deployed repo
on:
push:
branches: [ main ]
env:
ORIGINAL_REPO: github.com/DV-Lab/dvlab-document
DEPLOYED_REPO: github.com/tranhuyducseven/dvlab-document
USERNAME: tranhuyducseven
EMAIL: tranhuyducseven@gmail.com
jobs:
sync:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
token: ${{ secrets.SUPER_TOKEN }}
- name: Clone repo
run : |
echo "Clone ${{ env.ORIGINAL_REPO }} && ${{ env.DEPLOYED_REPO }}"
git clone https://${{ secrets.SUPER_TOKEN }}@${{ env.ORIGINAL_REPO }}.git origin
git clone https://${{ secrets.SUPER_TOKEN }}@${{ env.DEPLOYED_REPO }}.git temp
- name: Setup global config
run : |
- name: Copy files
run : |
echo "[LOG] Copying all origin files to temp"
cp origin/**.**.js temp
cp origin/**.js temp
cp -r origin/blog temp
cp -r origin/docs temp
cp origin/package**.json temp
cp origin/README.md temp
cp -r origin/src temp
cp -r origin/static temp
cd temp
rm -rf .github
- name: Push and commit
run : |
echo "[LOG] Setup global config"
git config --global user.email "${{ env.EMAIL }}"
git config --global user.name "${{ env.USERNAME }}-bot"
git remote set-url origin https://x-access-token:${{ secrets.SUPER_TOKEN }}@${{ env.DEPLOYED_REPO }}
cd temp
echo "[LOG] Git add and commit"
git add .
git commit -m "Synchronize from private repository - Triggered by Github Workflows"
echo "[LOG] Git push"
git push
- name: Remove temp folder
run : |
rm -rf temp
rm -rf origin
ls -al