add Create Release and Publish.yml #20
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: develop # 指定 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.117 # 跟 GW(Gin-Wei) 開發環境一致 | |
| - name: Restore dependencies | |
| run: dotnet restore VMSystem/VMSystem.sln | |
| - name: Publish project | |
| run: dotnet publish VMSystem/VMSystem.csproj -c Release -r win-x64 --self-contained true -o VMSystem-publish --force /p:RuntimeVersion=8.0.17 | |
| # 如果有多個設定檔,可以換成你需要的 pubxml | |
| - name: Compress output | |
| run: | | |
| $tag = "${{ github.ref_name }}" | |
| $publishPath = Join-Path $PWD "VMSystem-publish" | |
| $zipPath = Join-Path $PWD "VMSystem-publish-$tag.zip" | |
| Compress-Archive -Path "$publishPath" -DestinationPath $zipPath -Force | |
| - 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 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |