Skip to content

Commit a998b66

Browse files
committed
[Core] Add CI to sync to GitCode
1 parent 4f5206c commit a998b66

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

.github/workflows/autosync.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: "Sync to GitCode"
2+
3+
on:
4+
push:
5+
branches:
6+
- "main"
7+
8+
jobs:
9+
sync:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout code
13+
uses: actions/checkout@v4
14+
with:
15+
fetch-depth: 0
16+
fetch-tags: true
17+
18+
- name: Set up credentials
19+
shell: bash
20+
run: |
21+
mkdir -p ~/.ssh
22+
echo "${{ secrets.GITCODE_SSHKEY_PUBLIC }}" > ~/.ssh/id_ed25519.pub
23+
echo "${{ secrets.GITCODE_SSHKEY_PRIVATE }}" > ~/.ssh/id_ed25519
24+
chmod 600 ~/.ssh/id_ed25519
25+
chmod 644 ~/.ssh/id_ed25519.pub
26+
chmod 700 ~/.ssh
27+
28+
- name: Scan key
29+
shell: bash
30+
run: ssh-keyscan -t rsa gitcode.com >> ~/.ssh/known_hosts
31+
32+
- name: Sync with GitCode
33+
shell: bash
34+
# WARNING: never force push
35+
run: |
36+
git config --global user.name "GitHub-CI"
37+
git config --global user.email "dummy@gmail.com"
38+
git remote add gitcode git@gitcode.com:preppipe/preppipe-python.git
39+
git push gitcode main
40+
git push gitcode --tags

0 commit comments

Comments
 (0)