Skip to content

Commit 5d06d30

Browse files
committed
test
1 parent 33a1efc commit 5d06d30

File tree

1 file changed

+4
-32
lines changed

1 file changed

+4
-32
lines changed

.github/workflows/create-git-branch-package-on-release.yml

Lines changed: 4 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,6 @@ name: Create Git Branch Package on Release
33
on:
44
release:
55
types: [created]
6-
workflow_dispatch:
7-
inputs:
8-
tag_version:
9-
description: "要打包的标签版本 (例如 v1.0.0)"
10-
required: true
11-
type: string
12-
target_branch:
13-
description: "目标分支 (默认: main)"
14-
required: false
15-
default: "fix/private-submodule"
16-
type: string
176

187
jobs:
198
create-package:
@@ -32,23 +21,18 @@ jobs:
3221
- name: Safe submodule initialization
3322
env:
3423
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
35-
BOT_TOKEN: ${{ secrets.BOT_TOKEN }}
3624
run: |
37-
# 设置GitHub Actions Bot身份
3825
git config --global user.name "github-actions[bot]"
3926
git config --global user.email "github-actions[bot]@users.noreply.github.com"
4027
41-
# 关键修复:将git@github.com格式的URL转换为https格式并使用令牌
42-
# git config --global url."https://x-access-token:${{ secrets.BOT_TOKEN }}@github.com/".insteadOf "git@github.com:"
4328
git config --global url."https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/".insteadOf "git@github.com:"
29+
git config --global url."https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/".insteadOf "https://github.com/"
4430
45-
# 修改.gitmodules文件以使用HTTPS URL
4631
if [ -f .gitmodules ]; then
4732
echo "Converting SSH URLs to HTTPS in .gitmodules"
4833
sed -i 's|git@github.com:|https://github.com/|g' .gitmodules
4934
git config --file=.gitmodules --get-regexp url | while read key url; do
50-
# 为每个子模块URL添加认证信息
51-
new_url=$(echo "$url" | sed "s|https://github.com/|https://x-access-token:${{ secrets.BOT_TOKEN }}@github.com/|g")
35+
new_url=$(echo "$url" | sed "s|https://github.com/|https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/|g")
5236
git config --file=.gitmodules "${key}" "${new_url}"
5337
done
5438
cat .gitmodules
@@ -58,11 +42,9 @@ jobs:
5842
if [ -f .gitmodules ]; then
5943
if [ -s .gitmodules ]; then
6044
echo "Initializing submodules..."
61-
# 显示子模块配置信息进行调试
6245
echo "Submodule configuration:"
6346
cat .gitmodules
6447
65-
# 使用配置的凭据克隆子模块
6648
git submodule sync --recursive
6749
git submodule update --init --force --recursive || {
6850
echo "Warning: Some submodules failed to initialize, continuing anyway..."
@@ -96,21 +78,14 @@ jobs:
9678
9779
mkdir -p temp-package/$PROJECT_NAME-${{ env.TAG_VERSION }}
9880
99-
# 修复: 复制所有文件和目录,排除temp-package
100-
echo "复制已克隆的仓库(包含子模块)..."
10181
for item in $(ls -A | grep -v "temp-package"); do
10282
cp -r "$item" temp-package/$PROJECT_NAME-${{ env.TAG_VERSION }}/
10383
done
10484
10585
cd temp-package/$PROJECT_NAME-${{ env.TAG_VERSION }}
10686
107-
# 检查子模块目录内容
108-
echo "检查子模块目录内容:"
10987
find . -type d -name "protocol-enterprise" -exec ls -la {} \; || echo "找不到子模块目录"
11088
111-
# # 移除 .git 目录但保留 .git 文件(这样可以保留 Git 仓库状态而不包含完整历史)
112-
# find . -name ".git" -type d | grep -v "^./.git$" | xargs rm -rf
113-
11489
git config user.name "github-actions[bot]"
11590
git config user.email "github-actions[bot]@users.noreply.github.com"
11691
@@ -134,20 +109,17 @@ jobs:
134109
git log --oneline -5 2>/dev/null || echo "No git history found"
135110
git remote -v 2>/dev/null || echo "No remotes found"
136111
137-
# 显示子模块内容以确认存在
138-
echo "子模块目录内容:"
139-
find . -type d -name "protocol-enterprise" -exec ls -la {} \; || echo "找不到子模块目录"
140112
141113
cd ..
142114
143115
zip -r ../$PROJECT_NAME-${{ env.TAG_VERSION }}-with-git.zip $PROJECT_NAME-${{ env.TAG_VERSION }}/
144116
tar -czf ../$PROJECT_NAME-${{ env.TAG_VERSION }}-with-git.tar.gz $PROJECT_NAME-${{ env.TAG_VERSION }}/
145117
146118
cd ..
147-
echo "创建的文件大小:"
119+
echo "Create file Size:"
148120
du -h $PROJECT_NAME-${{ env.TAG_VERSION }}-with-git.*
149121
150-
echo "打包文件内容概览:"
122+
echo "Package contents overview:"
151123
unzip -l $PROJECT_NAME-${{ env.TAG_VERSION }}-with-git.zip | grep protocol-enterprise | head -10
152124
153125
- name: Upload custom source packages to existing release

0 commit comments

Comments
 (0)