Skip to content

Commit 8eb2741

Browse files
committed
6
1 parent f090a06 commit 8eb2741

File tree

2 files changed

+3
-71
lines changed

2 files changed

+3
-71
lines changed

.github/workflows/validation-proxy.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,6 @@ jobs:
3434
with:
3535
repository: ${{ inputs.upstream_repository }}
3636
main_branch: ${{ inputs.main_branch }}
37-
# cd_path: ${{ inputs.name }}/ci
38-
# cd_branch: ${{ inputs.main_branch }}_-_cd_-_${{ inputs.name }}
3937
dist_path: ${{ inputs.upstream_dist_path }}
4038
dist_branch: ${{ inputs.main_branch }}_-_dist_-_${{ inputs.name }}
4139
sync:

.github/workflows/validation.yml

Lines changed: 3 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,6 @@ on:
1212
main_branch: # 上游主分支
1313
required: true
1414
type: string
15-
# cd_path: # (Github)持续交付路径, 不能以 / 结尾
16-
# required: true
17-
# type: string
18-
# cd_branch: # 不能包含 / 等字符
19-
# required: true
20-
# type: string
2115
dist_path: # 分发路径, 不能以 / 结尾
2216
required: true
2317
type: string
@@ -52,17 +46,7 @@ jobs:
5246
echo "branch_exists=false" >> $GITHUB_OUTPUT
5347
echo "Remote branch ${{ inputs.dist_branch }} does not exist."
5448
fi
55-
# - name: Check if cd_branch exists in the remote
56-
# id: cd_branch-exists
57-
# run: |
58-
# # grep -qE 使用了 -E 参数来启用扩展的正则表达式, 并且使用了 $ 符号来确保匹配的字符串以 main 结尾, 达到精准匹配的目的
59-
# if git ls-remote --heads origin | grep -qE 'refs/heads/${{ inputs.cd_branch }}$'; then
60-
# echo "branch_exists=true" >> $GITHUB_OUTPUT
61-
# echo "Remote branch ${{ inputs.cd_branch }} exists."
62-
# else
63-
# echo "branch_exists=false" >> $GITHUB_OUTPUT
64-
# echo "Remote branch ${{ inputs.cd_branch }} does not exist."
65-
# fi
49+
6650
- name: Sync dist_path from main_branch to exists dist_branch
6751
if: steps.dist_branch-exists.outputs.branch_exists == 'true'
6852
run: |
@@ -84,27 +68,7 @@ jobs:
8468
git commit -m "🪂 Sync ${{ inputs.dist_path }} from ${{ inputs.main_branch }} to ${{ inputs.dist_branch }}" || echo "No changes to commit"
8569
# 删除临时分支
8670
git branch -D temp_${{ inputs.main_branch }}
87-
# - name: Sync cd_path from main_branch to exists cd_branch
88-
# if: steps.cd_branch-exists.outputs.branch_exists == 'true'
89-
# run: |
90-
# # 主分支需要重复使用, 因此基于临时分支操作
91-
# git checkout -b temp_${{ inputs.main_branch }} ${{ inputs.main_branch }}
92-
# # 创建临时文件夹,如果它不存在的话
93-
# mkdir -p $HOME/tmp
94-
# # 清空临时文件夹的内容
95-
# find $HOME/tmp/ -mindepth 1 -maxdepth 1 -exec rm -rf {} +
96-
# ls -A $HOME/tmp/
97-
# rsync -a --exclude '.git' ${{ inputs.cd_path }}/ $HOME/tmp/
98-
# ls -A $HOME/tmp/
99-
# git checkout ${{ inputs.cd_branch }}
100-
# # 清空所有文件,除了.git目录
101-
# find . -mindepth 1 -maxdepth 1 ! -name '.git' -exec rm -rf {} +
102-
# rsync -a --exclude '.git' $HOME/tmp/ ./
103-
# find . -path './.git' -prune -o -exec ls -lR {} +
104-
# git add .
105-
# git commit -m "🪂 Sync ${{ inputs.cd_path }} from ${{ inputs.main_branch }} to ${{ inputs.cd_branch }}" || echo "No changes to commit"
106-
# # 删除临时分支
107-
# git branch -D temp_${{ inputs.main_branch }}
71+
10872
- name: Init dist_branch from dist_path at main_branch
10973
if: steps.dist_branch-exists.outputs.branch_exists == 'false'
11074
run: |
@@ -124,25 +88,7 @@ jobs:
12488
git commit -m "🪂 Initial ${{ inputs.dist_path }} from ${{ inputs.main_branch }} to ${{ inputs.dist_branch }}"
12589
# 删除临时分支
12690
git branch -D temp_${{ inputs.main_branch }}
127-
# - name: Init cd_branch from cd_path at main_branch
128-
# if: steps.cd_branch-exists.outputs.branch_exists == 'false'
129-
# run: |
130-
# # 主分支需要重复使用, 因此基于临时分支操作
131-
# git checkout -b temp_${{ inputs.main_branch }} ${{ inputs.main_branch }}
132-
# # 创建临时文件夹,如果它不存在的话
133-
# mkdir -p $HOME/tmp
134-
# # 清空临时文件夹的内容
135-
# find $HOME/tmp/ -mindepth 1 -maxdepth 1 -exec rm -rf {} +
136-
# rsync -a --exclude '.git' ${{ inputs.cd_path }}/ $HOME/tmp/
137-
# # 清空所有文件,除了.git目录
138-
# find . -mindepth 1 -maxdepth 1 ! -name '.git' -exec rm -rf {} +
139-
# # 创建一个全新的分支, 不基于任何现有的提交
140-
# git checkout --orphan ${{ inputs.cd_branch }}
141-
# rsync -a --exclude '.git' $HOME/tmp/ ./
142-
# git add .
143-
# git commit -m "🪂 Initial ${{ inputs.cd_path }} from ${{ inputs.main_branch }} to ${{ inputs.cd_branch }}"
144-
# # 删除临时分支
145-
# git branch -D temp_${{ inputs.main_branch }}
91+
14692
- run: |
14793
git checkout ${{ inputs.dist_branch }}
14894
- name: Push dist_branch
@@ -155,15 +101,3 @@ jobs:
155101
# force_with_lease: true # 仅在远程分支自上次检出以来没有其他提交的情况下成功
156102
env:
157103
github_token: ${{ secrets.TOEKN_FOREVER_FULL_WRITE }} # 使用具有完全写入权限的 TOKEN(必须包含 workflows )
158-
# - run: |
159-
# git checkout ${{ inputs.cd_branch }}
160-
# - name: Push cd_branch
161-
# id: push_cd_branch
162-
# uses: ad-m/github-push-action@master
163-
# with:
164-
# repository: ${{ inputs.repository }}
165-
# branch: ${{ inputs.cd_branch }}
166-
# force: true
167-
# # force_with_lease: true # 仅在远程分支自上次检出以来没有其他提交的情况下成功
168-
# env:
169-
# github_token: ${{ secrets.TOEKN_FOREVER_FULL_WRITE }} # 使用具有完全写入权限的 TOKEN(必须包含 workflows )

0 commit comments

Comments
 (0)