-
Notifications
You must be signed in to change notification settings - Fork 2
/
.gitlab-ci.yml
52 lines (49 loc) · 1.69 KB
/
.gitlab-ci.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
variables:
GIT_BRANCH: "${CI_COMMIT_REF_SLUG}"
GIT_SUBMODULE_STRATEGY: recursive
stages:
- sync-from-github
- sync-to-github
sync_from_github_job:
stage: sync-from-github
before_script:
- apk add --no-cache git openssh-client
- mkdir -p ~/.ssh
- echo "${SSH_PRIVATE_KEY}" | tr -d '\r' > ~/.ssh/id_rsa
- chmod 600 ~/.ssh/id_rsa
- ssh-keyscan gitlab.snapp.ir >> ~/.ssh/known_hosts
- ssh-keyscan github.com >> ~/.ssh/known_hosts
script:
- echo "Starting sync-from-github job"
- git config --global user.email "[email protected]"
- git config --global user.name "Platform"
- git clone [email protected]:snapp-incubator/smapp-sdk-go.git
- cd smapp-sdk-go
- git remote add gitlab [email protected]:Map/sdk/smapp-sdk-go.git
- git fetch origin main
- git fetch gitlab $GIT_BRANCH
- git merge gitlab/$GIT_BRANCH
- git push gitlab HEAD:$GIT_BRANCH
only:
- schedules
sync_to_github_job:
stage: sync-to-github
before_script:
- apk add --no-cache git openssh-client
- mkdir -p ~/.ssh
- echo "${SSH_PRIVATE_KEY}" | tr -d '\r' > ~/.ssh/id_rsa
- chmod 600 ~/.ssh/id_rsa
- ssh-keyscan gitlab.snapp.ir >> ~/.ssh/known_hosts
- ssh-keyscan github.com >> ~/.ssh/known_hosts
script:
- echo "Starting sync-to-github job"
- git config --global user.email "[email protected]"
- git config --global user.name "Platform"
- git clone [email protected]:snapp-incubator/smapp-sdk-go.git
- cd smapp-sdk-go
- git remote add gitlab [email protected]:Map/sdk/smapp-sdk-go.git
- git fetch origin main
- git fetch gitlab $GIT_BRANCH
- git merge gitlab/$GIT_BRANCH
- git push origin HEAD:main
when: manual