1- name : C++ Build with Dependencies
1+ name : windows build workflows
22
3- # on: [push] # 触发条件,推送和拉取请求时,
43on :
5- workflow_dispatch : # 添加这行来启用手动触发
4+ push :
5+ branches : [ "develop" ]
6+ pull_request :
7+ branches : [ "develop" ]
68
79permissions :
8- contents : write
10+ contents : read
911
1012jobs :
1113 build :
1214 strategy :
15+ # Set fail-fast to false to ensure that feedback is delivered for all matrix combinations. Consider changing this to true when your workflow is stable.
16+ fail-fast : false
1317 matrix :
14- configuration : [Release]
15- platform : [x86]
18+ configuration : [Debug , Release]
19+ platform : [x86 ,x64 ]
1620
1721 runs-on : windows-latest # 最新的 Windows 环境
1822
1923 steps :
2024 # 检出您的主仓库代码
2125 - name : Checkout main repository code
22- uses : actions/checkout@v3
26+ uses : actions/checkout@v4
27+ with :
28+ ref : ' develop'
2329
2430 # 检出依赖的xengine仓库到指定的xengine目录
2531 - name : Checkout dependency repository (xengine)
26- uses : actions/checkout@v3
32+ uses : actions/checkout@v4
2733 with :
28- repository : libxengine/xengine
34+ repository : libxengine/libxengine
2935 path : xengine
36+
37+ - name : sub module checkout (opensource)
38+ run : |
39+ git submodule init
40+ git submodule update
41+ shell : pwsh
3042
3143 # 设置依赖库的环境变量
3244 - name : Set up Dependency Environment Variables
@@ -42,61 +54,24 @@ jobs:
4254 # 编译
4355 - name : Build Solution
4456 run : msbuild XEngine_Source/XEngine_StorageApp.sln /p:Configuration=${{ matrix.configuration }} /p:Platform=${{ matrix.platform }}
45-
46- # 打包
47- - name : Copy Build binaries for x86
57+ # 测试
58+ - name : Conditional Step for x86 Release
59+ if : matrix.configuration == 'Release' && matrix.platform == ' x86'
4860 run : |
49- mkdir -p "x86/XEngine_StorageApp"
50- cp -r ./XEngine_Release/* x86/XEngine_StorageApp/
51- cp -r ./XEngine_Source/Release/*.dll x86/XEngine_StorageApp/
52- cp -r ./XEngine_Source/Release/*.exe x86/XEngine_StorageApp/
53- cp -r ./XEngine_Source/VSCopy_x86.bat x86/XEngine_StorageApp/
54- cd x86/XEngine_StorageApp && ./VSCopy_x86.bat
55- cd ..
56- cd ..
57- 7z a XEngine_StorageApp-x86-Windows.zip ./x86/XEngine_StorageApp/*
61+ cp -r XEngine_Source/Release/*.dll XEngine_Release/
62+ cp -r XEngine_Source/Release/*.exe XEngine_Release/
63+ cp -r XEngine_Source/VSCopy_x86.bat XEngine_Release/
64+ cd XEngine_Release
65+ ./VSCopy_x86.bat
66+ ./XEngine_StorageApp.exe -t
5867 shell : pwsh
59-
60- - name : Calculate new tag
61- id : newtag
62- shell : bash
68+ - name : Conditional Step for x86 Debug
69+ if : matrix.configuration == 'Debug' && matrix.platform == 'x86'
6370 run : |
64- git fetch --tags
65- TAG=$(git tag --sort=-v:refname | head -n 1)
66- MAJOR=$(echo $TAG | cut -d '.' -f 1)
67- MINOR=$(echo $TAG | cut -d '.' -f 2)
68- PATCH=$(echo $TAG | cut -d '.' -f 3)
69- BUILD=$(echo $TAG | cut -d '.' -f 4)
70- MINOR_BUMP=$((MINOR + 1))
71- NEW_TAG="${MAJOR}.${MINOR_BUMP}.0.${BUILD}"
72- echo "NEW_TAG=$NEW_TAG" >> $GITHUB_ENV
73- git config --local user.email "action@github.com"
74- git config --local user.name "GitHub Action"
75- git tag $NEW_TAG
76- git push origin $NEW_TAG
77-
78- # 创建GitHub Release
79- - name : Create Release
80- id : create_release
81- uses : softprops/action-gh-release@v1
82- with :
83- tag_name : ${{ env.NEW_TAG }}
84- name : Release ${{ env.NEW_TAG }}
85- body : |
86- [${{ github.sha }}](https://github.com/libxengine/XEngine_Storage/commit/${{ github.sha }})
87- ${{ github.event.head_commit.message }}
88- draft : false
89- prerelease : false
90- env :
91- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
92-
93- # 上传x86的zip包作为发布的artifacts
94- - name : Upload x86 Release Asset
95- uses : actions/upload-release-asset@v1
96- env :
97- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
98- with :
99- upload_url : ${{ steps.create_release.outputs.upload_url }}
100- asset_path : ./XEngine_StorageApp-x86-Windows.zip
101- asset_name : XEngine_StorageApp-x86-Windows.zip
102- asset_content_type : application/zip
71+ cp -r XEngine_Source/Debug/*.dll XEngine_Release/
72+ cp -r XEngine_Source/Debug/*.exe XEngine_Release/
73+ cp -r XEngine_Source/VSCopy_x86.bat XEngine_Release/
74+ cd XEngine_Release
75+ ./VSCopy_x86.bat
76+ ./XEngine_StorageApp.exe -t
77+ shell : pwsh
0 commit comments