優化任務取消或終止時上報SECS事件 #30
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Create Release and Publish | |
| on: | |
| push: | |
| tags: | |
| - "v*" # 觸發條件:建立新 tag,例如 v1.0.0 | |
| permissions: | |
| contents: write | |
| jobs: | |
| publish: | |
| runs-on: windows-latest | |
| steps: | |
| - name: Checkout main repo | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: gpmagvs/VMSystem | |
| path: VMSystem | |
| ref: develop # 指定 branch 或 tag | |
| - name: Checkout AGVSystemCommonNet6 repo | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: gpmagvs/AGVSystemCommonNet6 # 這裡換成你需要拉取的 repo | |
| path: AGVSystemCommonNet6 | |
| ref: develop # 指定 branch 或 tag | |
| - name: Checkout EquipmentManagment repo | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: gpmagvs/EquipmentManagment # 這裡換成你需要拉取的 repo | |
| path: EquipmentManagment | |
| ref: develop # 指定 branch 或 tag | |
| - name: Checkout RosBridgeClient repo | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: gpmagvs/RosBridgeClient # 這裡換成你需要拉取的 repo | |
| path: RosBridgeClient | |
| ref: master # 指定 branch 或 tag | |
| - name: Checkout KGSWebAGVSystemAPI repo | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: gpmagvs/KGSWebAGVSystemAPI # 這裡換成你需要拉取的 repo | |
| path: KGSWebAGVSystemAPI | |
| ref: master # 指定 branch 或 tag | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: 8.0.414 # 跟 GW(Gin-Wei) 開發環境一致 | |
| include-prerelease: false | |
| - name: Restore dependencies | |
| run: dotnet restore VMSystem/VMSystem.csproj -r win-x64 | |
| - name: Build project | |
| run: dotnet build VMSystem/VMSystem.csproj -c Release -r win-x64 --no-restore | |
| - name: Publish project | |
| run: dotnet publish VMSystem/VMSystem.csproj -c Release -r win-x64 --no-build --self-contained true -o VMSystem-publish --force | |
| # 如果有多個設定檔,可以換成你需要的 pubxml | |
| - name: Compress output | |
| run: | | |
| $tag = "${{ github.ref_name }}" | |
| $publishPath = Join-Path $PWD "VMSystem-publish" | |
| $zipPath = Join-Path $PWD "VMSystem-publish-$tag.zip" | |
| $zipPath_use_for_patch = Join-Path $PWD "VMSystem-publish-${tag}_patch.zip" | |
| Compress-Archive -Path "$publishPath\*" -DestinationPath $zipPath -Force | |
| # 要壓縮的檔案列表 | |
| $files = @( | |
| "${publishPath}\version.json", | |
| "${publishPath}\web.config", | |
| "${publishPath}\VMSystem.deps.json", | |
| "${publishPath}\VMSystem.exe", | |
| "${publishPath}\VMSystem.dll", | |
| "${publishPath}\VMSystem.pdb", | |
| "${publishPath}\VMSystem.xml", | |
| "${publishPath}\VMSystem.staticwebassets.endpoints.json", | |
| "${publishPath}\AGVSystemCommonNet6.dll", | |
| "${publishPath}\AGVSystemCommonNet6.pdb", | |
| "${publishPath}\KGSWebAGVSystemAPI.dll", | |
| "${publishPath}\KGSWebAGVSystemAPI.pdb", | |
| "${publishPath}\RosBridgeClient.dll", | |
| "${publishPath}\RosBridgeClient.pdb", | |
| "${publishPath}\EquipmentManagment.dll", | |
| "${publishPath}\EquipmentManagment.pdb", | |
| "${publishPath}\Polly.Core.dll", | |
| "${publishPath}\Polly.dll", | |
| "${publishPath}\INIFileParser.dll", | |
| "${publishPath}\Swashbuckle.AspNetCore.SwaggerUI.dll", | |
| "${publishPath}\Swashbuckle.AspNetCore.SwaggerGen.dll", | |
| "${publishPath}\Swashbuckle.AspNetCore.Swagger.dll" | |
| ) | |
| # 只保留存在的檔案 | |
| $existingFiles = $files | Where-Object { Test-Path $_ } | |
| if ($existingFiles.Count -gt 0) { | |
| Compress-Archive -Path $existingFiles -DestinationPath $zipPath_use_for_patch -Force | |
| } else { | |
| Write-Host "⚠️ 沒有找到任何檔案,跳過壓縮" | |
| } | |
| - name: Create GitHub Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| body: | | |
| ## 🚀 What's Changed | |
| - something changed | |
| ## 🐞 What's Fixed | |
| - something fixed | |
| ## 📦 HeadCommit Message | |
| ${{ github.event.head_commit.message }} | |
| ## 🔗 Full Changelog | |
| ${{ github.server_url }}/${{ github.repository }}/compare/${{ github.event.release.tag_name }}^...${{ github.event.release.tag_name }} | |
| files: | | |
| VMSystem-publish-${{ github.ref_name }}.zip | |
| VMSystem-publish-${{ github.ref_name }}_patch.zip | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |