forked from NAStool/nas-tools
-
Notifications
You must be signed in to change notification settings - Fork 4
110 lines (90 loc) · 3.63 KB
/
Merge-upsteam.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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
name: Merge upstream
on:
# 推送代码后触发
# push:
# 定时任务触发,使用 cron 规则,这里默认一小时执行一次
# schedule:
# - cron: '*/60 * * * *' # every 60 minutes
workflow_dispatch: # on button click
repository_dispatch: # 利用update-chechker.yml检测到更新后,再更新上游代码
jobs:
merge:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
token: ${{ secrets.ACTIONS_TRIGGER_PAT1 }} #必须在这里加上这个,不然不能更新带WORKFLOW的变动
fetch-depth: 0
# - name: install yq #放在脚本内,以便减少不必要的安装
# run: |
# sudo snap install yq
- name: Setup git
run: |
git config --global user.name "sungamma"
git config --global user.email "[email protected]"
# - name: Setup Debug Session
# uses: csexton/debugger-action@master
- name: Compare the build.yml and update the build-2.yml #防止原作者更新编译文件
run: |
cd .github/workflows
bash compare/merge.sh
- name: Merge upstream
run: |
# 使用自己的用户名替换 username
# git pull --unshallow
# 自行替换要同步的上游仓库地址
git remote add upstream https://github.com/NAStool/nas-tools.git
git fetch upstream
# 可以自定义要同步的分支
# git checkout -b master origin/master
git rebase upstream/master # rebase 处理可能存在的冲突
git push -u origin master -f
# 激活Build NAStool Image 工作流的workflow-dispatch,以便运行
- name: Invoke workflow without inputs. Wait for result-BUILD DOCKER
uses: aurelien-baudet/workflow-dispatch@v2
with:
workflow: NAStool Docker
token: ${{ secrets.ACTIONS_TRIGGER_PAT1 }}
wait-for-completion: false
# 激活Build NAStool Package-2 工作流的workflow-dispatch,以便运行
- name: Invoke workflow without inputs. Wait for result-BUILD EXE
uses: aurelien-baudet/workflow-dispatch@v2
with:
workflow: NAStool Package-2
token: ${{ secrets.ACTIONS_TRIGGER_PAT1 }}
wait-for-completion: false
# 备份之前成功的设置
# jobs:
# merge:
# runs-on: ubuntu-latest
# steps:
# - name: Setup git infomation
# run: |
# # 使用自己的用户名替换 username
# git config --global user.email "[email protected]"
# git config --global user.name "sungamma"
# - name: Setup SSH Private Key
# env:
# token_Private_Keys: ${{ secrets.SSH_PRIVATE_KEY }}
# run: |
# mkdir -p ~/.ssh/
# echo "$token_Private_Keys" > ~/.ssh/id_rsa
# chmod 600 ~/.ssh/id_rsa
# - uses: actions/checkout@v3
# with:
# # persist-credentials: false
# token: ${{ secrets.ACTIONS_TRIGGER_PAT1 }} #必须在这里加上这个,不然不能更新带WORKFLOW的变动
# fetch-depth: 0
# - name: Fetch upstream
# run: |
# # 自行替换要同步的上游仓库地址
# git remote add upstream https://github.com/jxxghp/nas-tools.git
# git fetch upstream
# - name: Merge upstream
# run: |
# # 可以自定义要同步的分支
# # git checkout -b master origin/master
# git rebase upstream/master # rebase 处理可能存在的冲突
# - name: Push changes
# run: |
# git push -f