@@ -2,134 +2,129 @@ name: Build Multi-Platform Binaries
22
33on :
44 pull_request :
5+ branches : [develop, main]
56 types : [opened, synchronize, reopened]
67
8+ concurrency :
9+ group : pr-binaries-${{ github.event.pull_request.number }}
10+ cancel-in-progress : true
11+
12+ permissions :
13+ contents : read
14+ pull-requests : write
15+
716jobs :
817 build-macos-intel :
918 runs-on : macos-latest
10- outputs :
11- artifact_id : ${{ steps.upload.outputs.artifact-id }}
12- artifact_url : ${{ steps.upload.outputs.artifact-url }}
1319 steps :
14- - uses : actions/checkout@v6
15- - name : Setup Flutter
16- uses : subosito/flutter-action@v2
20+ - uses : actions/checkout@v4
21+ - uses : subosito/flutter-action@v2
1722 with :
18- flutter-version : ' 3.32.0'
19- - name : Install dependencies
20- run : flutter pub get
21- - name : Build macOS Intel
22- run : dart compile exe bin/main.dart -o api_tool_macos_intel
23+ flutter-version : " 3.32.0"
24+ channel : stable
25+ cache : true
26+ - run : flutter pub get
27+ - run : dart compile exe bin/main.dart -o api_tool_macos_intel
2328 - name : Verify binary
2429 run : |
2530 git clone --depth 1 --branch develop https://github.com/Tencent/tdesign-flutter.git
2631 dart run .github/scripts/cross_platform_verify.dart tdesign-flutter api_tool_macos_intel
27- - name : Upload Artifact
28- id : upload
29- uses : actions/upload-artifact@v4
32+ - uses : actions/upload-artifact@v4
3033 with :
3134 name : api_tool_macos_intel
3235 path : api_tool_macos_intel
3336
3437 build-macos-arm64 :
3538 runs-on : macos-latest
36- outputs :
37- artifact_id : ${{ steps.upload.outputs.artifact-id }}
38- artifact_url : ${{ steps.upload.outputs.artifact-url }}
3939 steps :
40- - uses : actions/checkout@v6
41- - name : Setup Flutter
42- uses : subosito/flutter-action@v2
40+ - uses : actions/checkout@v4
41+ - uses : subosito/flutter-action@v2
4342 with :
44- flutter-version : ' 3.32.0'
45- - name : Install dependencies
46- run : flutter pub get
47- - name : Build macOS ARM64
48- run : dart compile exe bin/main.dart -o api_tool_macos_arm64 --target-os=macos --target-arch=arm64
43+ flutter-version : " 3.32.0"
44+ channel : stable
45+ cache : true
46+ - run : flutter pub get
47+ - run : dart compile exe bin/main.dart -o api_tool_macos_arm64 --target-os=macos --target-arch=arm64
4948 - name : Verify binary
5049 run : |
5150 git clone --depth 1 --branch develop https://github.com/Tencent/tdesign-flutter.git
5251 dart run .github/scripts/cross_platform_verify.dart tdesign-flutter api_tool_macos_arm64
53- - name : Upload Artifact
54- id : upload
55- uses : actions/upload-artifact@v4
52+ - uses : actions/upload-artifact@v4
5653 with :
5754 name : api_tool_macos_arm64
5855 path : api_tool_macos_arm64
5956
6057 build-linux-x64 :
6158 runs-on : ubuntu-latest
62- outputs :
63- artifact_id : ${{ steps.upload.outputs.artifact-id }}
64- artifact_url : ${{ steps.upload.outputs.artifact-url }}
6559 steps :
66- - uses : actions/checkout@v6
67- - name : Setup Flutter
68- uses : subosito/flutter-action@v2
60+ - uses : actions/checkout@v4
61+ - uses : subosito/flutter-action@v2
6962 with :
70- flutter-version : ' 3.32.0'
71- - name : Install dependencies
72- run : flutter pub get
73- - name : Build Linux x64
74- run : dart compile exe bin/main.dart -o api_tool_linux --target-arch=x64
63+ flutter-version : " 3.32.0"
64+ channel : stable
65+ cache : true
66+ - run : flutter pub get
67+ - run : dart compile exe bin/main.dart -o api_tool_linux --target-arch=x64
7568 - name : Verify binary
7669 run : |
7770 git clone --depth 1 --branch develop https://github.com/Tencent/tdesign-flutter.git
7871 dart run .github/scripts/cross_platform_verify.dart tdesign-flutter api_tool_linux
79- - name : Upload Artifact
80- id : upload
81- uses : actions/upload-artifact@v4
72+ - uses : actions/upload-artifact@v4
8273 with :
8374 name : api_tool_linux
8475 path : api_tool_linux
8576
8677 build-windows-x64 :
8778 runs-on : windows-latest
88- outputs :
89- artifact_id : ${{ steps.upload.outputs.artifact-id }}
90- artifact_url : ${{ steps.upload.outputs.artifact-url }}
9179 steps :
92- - uses : actions/checkout@v6
93- - name : Setup Flutter
94- uses : subosito/flutter-action@v2
80+ - uses : actions/checkout@v4
81+ - uses : subosito/flutter-action@v2
9582 with :
96- flutter-version : ' 3.32.0'
97- - name : Install dependencies
98- run : flutter pub get
99- - name : Build Windows x64
100- run : dart compile exe bin/main.dart -o api_tool_windows.exe
83+ flutter-version : " 3.32.0"
84+ channel : stable
85+ cache : true
86+ - run : flutter pub get
87+ - run : dart compile exe bin/main.dart -o api_tool_windows.exe
10188 - name : Verify binary
89+ shell : bash
10290 run : |
10391 git clone --depth 1 --branch develop https://github.com/Tencent/tdesign-flutter.git
10492 dart run .github/scripts/cross_platform_verify.dart tdesign-flutter api_tool_windows.exe
105- - name : Upload Artifact
106- id : upload
107- uses : actions/upload-artifact@v4
93+ - uses : actions/upload-artifact@v4
10894 with :
10995 name : api_tool_windows
11096 path : api_tool_windows.exe
11197
11298 comment-on-pr :
99+ name : 更新二进制产物 PR 评论
113100 needs : [build-macos-intel, build-macos-arm64, build-linux-x64, build-windows-x64]
114101 runs-on : ubuntu-latest
115102 steps :
116- - name : Find Comment
117- id : find-comment
118- uses : peter-evans/find-comment@v3
119- with :
120- issue-number : ${{ github.event.pull_request.number }}
121- comment-author : ' github-actions[bot]'
122- body-includes : 编译完成,产物如下
123-
124- - name : Create or Update PR Comment
125- uses : peter-evans/create-or-update-comment@v4
103+ - name : 组装产物下载链接
104+ id : binary-comment
105+ env :
106+ GH_REPO : ${{ github.repository }}
107+ RUN_ID : ${{ github.run_id }}
108+ run : |
109+ base="https://github.com/${GH_REPO}/actions/runs/${RUN_ID}"
110+ {
111+ echo 'body<<EOF'
112+ echo "✅ 编译完成,产物如下:"
113+ echo "- [api_tool_macos_intel](${base}/artifacts)(job: build-macos-intel)"
114+ echo "- [api_tool_macos_arm64](${base}/artifacts)(job: build-macos-arm64)"
115+ echo "- [api_tool_linux](${base}/artifacts)(job: build-linux-x64)"
116+ echo "- [api_tool_windows](${base}/artifacts)(job: build-windows-x64)"
117+ echo ""
118+ echo "<!-- AUTO_BINARY_BUILD_HOOK -->"
119+ echo ""
120+ echo "_在 Actions 运行页 Artifacts 区域按平台名称下载。_"
121+ echo 'EOF'
122+ } >> "$GITHUB_OUTPUT"
123+
124+ - name : 更新 PR 评论
125+ uses : TDesignOteam/workflows/actions/maintain-one-comment@main
126126 with :
127- comment-id : ${{ steps.find-comment.outputs.comment-id }}
128- issue-number : ${{ github.event.pull_request.number }}
129- body : |
130- ✅ 编译完成,产物如下:
131- - [api_tool_macos_intel](${{ needs.build-macos-intel.outputs.artifact_url }})
132- - [api_tool_macos_arm64](${{ needs.build-macos-arm64.outputs.artifact_url }})
133- - [api_tool_linux](${{ needs.build-linux-x64.outputs.artifact_url }})
134- - [api_tool_windows](${{ needs.build-windows-x64.outputs.artifact_url }})
135- edit-mode : replace
127+ token : ${{ secrets.GITHUB_TOKEN }}
128+ body : ${{ steps.binary-comment.outputs.body }}
129+ number : ${{ github.event.pull_request.number }}
130+ body-include : " <!-- AUTO_BINARY_BUILD_HOOK -->"
0 commit comments