-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy path.gitlab-ci.yml
36 lines (29 loc) · 1.17 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
# 定义环境变量,确保拉取完整历史记录
variables:
GIT_DEPTH: "0"
# 定义阶段
stages:
- sync
# 定时同步任务
sync_upstream:
stage: sync
# 仅在计划任务或手动触发时运行
only:
- schedules # 仅在 Pipeline Schedule 定时任务下运行
- manual # 手动触发
- main
script:
# 配置 Git 用户信息
- git config --global user.email "006lengpeng@gmail.com"
- git config --global user.name "006lp"
# 添加上游仓库
- git remote add upstream https://gitlab.com/Binaryify/neteasecloudmusicapi.git
- git fetch upstream main # 拉取上游 main 分支的更新
- git merge upstream/main # 合并上游的更新
# 推送到自己的 GitLab 仓库
- git remote set-url origin https://$GITLAB_USERNAME:$GITLAB_TOKEN@gitlab.com/006lp/NeteaseCloudMusicApi.git
- git checkout -b main origin/main
- git push origin main --force # 推送到自己 GitLab 仓库
# 推送到 GitHub 仓库
- git remote add github https://$GITHUB_USERNAME:$GITHUB_TOKEN@github.com/006lp/NeteaseCloudMusicApi.git
- git push github main --force # 推送到 GitHub