1+ name : Build Linux Binaries (x86_64 & ARM)
2+
3+ on :
4+ workflow_dispatch :
5+ push :
6+ tags :
7+ - " build.*"
8+
9+ jobs :
10+ build_pyc :
11+ name : Build for pyc files only
12+ runs-on : ubuntu-latest
13+ steps :
14+ - name : Checkout code
15+ uses : actions/checkout@v4
16+ with :
17+ repository : dataelement/bisheng-telemetry-search
18+ token : ${{ secrets.CROSS_REPO_TOKEN }}
19+ path : bisheng-telemetry-search
20+
21+ - name : Set up Python
22+ uses : actions/setup-python@v5
23+ with :
24+ python-version : ' 3.10'
25+
26+ - name : Build and Clean Artifacts
27+ working-directory : ./bisheng-telemetry-search/telemetry_search
28+ run : |
29+ # 执行构建
30+ python -m compileall -b .
31+
32+ # 在上传前彻底清理源代码和中间文件
33+ # 即使 build_all.py 做了清理,这里再次强制清理,防止 .c 文件泄露
34+ find . -name "*.py" -delete
35+ find . -name "__pycache__" -exec rm -rf {} +
36+
37+ # 准备输出
38+ mkdir ../../build_output
39+ cp -r ./* ../../build_output/
40+
41+ echo "Listing artifacts to be uploaded:"
42+ ls -R ../../build_output/
43+
44+ - name : Upload PYC Artifacts
45+ uses : actions/upload-artifact@v4
46+ with :
47+ name : telemetry_search
48+ path : ./build_output/*
49+
50+ deploy_to_sso_project :
51+ name : Deploy Artifacts to SSO Project
52+ needs : [ build_pyc ]
53+ runs-on : ubuntu-latest
54+ steps :
55+ - name : Checkout SSO Project
56+ uses : actions/checkout@v4
57+ with :
58+ repository : dataelement/bisheng
59+ token : ${{ secrets.CROSS_REPO_TOKEN }}
60+ # 使用 ref 指定分支,而不是 base
61+ ref : feat/2.3.0
62+ path : bisheng
63+ # 确保拉取完整的历史以便正确提交
64+ fetch-depth : 0
65+
66+ - name : Download PYC Artifacts
67+ uses : actions/download-artifact@v4
68+ with :
69+ name : telemetry_search
70+ path : ./telemetry_search
71+
72+ - name : Merge and Place Files
73+ run : |
74+
75+ find ./telemetry_search -name "*.py" -delete
76+
77+ # 移动到目标仓库目录
78+ cp -r ./telemetry_search ./bisheng/src/backend/bisheng/
79+
80+ echo "Final content of target directory:"
81+ ls -lh ./bisheng/src/backend/bisheng/telemetry_search
82+
83+ - name : Commit and Push changes
84+ working-directory : ./bisheng
85+ run : |
86+ git config --global user.name "github-actions[bot]"
87+ git config --global user.email "github-actions[bot]@users.noreply.github.com"
88+
89+ git add .
90+
91+ # 检查是否有变更,有才提交
92+ if git diff --staged --quiet; then
93+ echo "No changes to commit"
94+ else
95+ git commit -m "chore: update telemetry_search build artifacts [skip ci]"
96+ git push origin feat/2.3.0
97+ fi
0 commit comments