|
| 1 | +name: Create Release and Publish |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + tags: |
| 6 | + - "v*" # 觸發條件:建立新 tag,例如 v1.0.0 |
| 7 | + |
| 8 | +permissions: |
| 9 | + contents: write |
| 10 | + |
| 11 | +jobs: |
| 12 | + publish: |
| 13 | + runs-on: windows-latest |
| 14 | + |
| 15 | + steps: |
| 16 | + - name: Checkout main repo |
| 17 | + uses: actions/checkout@v4 |
| 18 | + with: |
| 19 | + repository: gpmagvs/VMSystem |
| 20 | + path: VMSystem |
| 21 | + ref: develop # 指定 branch 或 tag |
| 22 | + |
| 23 | + - name: Checkout AGVSystemCommonNet6 repo |
| 24 | + uses: actions/checkout@v4 |
| 25 | + with: |
| 26 | + repository: gpmagvs/AGVSystemCommonNet6 # 這裡換成你需要拉取的 repo |
| 27 | + path: AGVSystemCommonNet6 |
| 28 | + ref: develop # 指定 branch 或 tag |
| 29 | + |
| 30 | + - name: Checkout EquipmentManagment repo |
| 31 | + uses: actions/checkout@v4 |
| 32 | + with: |
| 33 | + repository: gpmagvs/EquipmentManagment # 這裡換成你需要拉取的 repo |
| 34 | + path: EquipmentManagment |
| 35 | + ref: develop # 指定 branch 或 tag |
| 36 | + |
| 37 | + - name: Checkout RosBridgeClient repo |
| 38 | + uses: actions/checkout@v4 |
| 39 | + with: |
| 40 | + repository: gpmagvs/RosBridgeClient # 這裡換成你需要拉取的 repo |
| 41 | + path: RosBridgeClient |
| 42 | + ref: develop # 指定 branch 或 tag |
| 43 | + |
| 44 | + - name: Checkout KGSWebAGVSystemAPI repo |
| 45 | + uses: actions/checkout@v4 |
| 46 | + with: |
| 47 | + repository: gpmagvs/KGSWebAGVSystemAPI # 這裡換成你需要拉取的 repo |
| 48 | + path: KGSWebAGVSystemAPI |
| 49 | + ref: master # 指定 branch 或 tag |
| 50 | + |
| 51 | + - name: Setup .NET |
| 52 | + uses: actions/setup-dotnet@v4 |
| 53 | + with: |
| 54 | + dotnet-version: 8.0.117 # 跟 GW(Gin-Wei) 開發環境一致 |
| 55 | + include-prerelease: false |
| 56 | + |
| 57 | + - name: Restore dependencies |
| 58 | + run: dotnet restore VMSystem/VMSystem.sln |
| 59 | + |
| 60 | + - name: Publish project |
| 61 | + run: dotnet publish VMSystem/VMSystem.csproj -c Release -r win-x64 --self-contained true -o VMSystem-publish --force |
| 62 | + # 如果有多個設定檔,可以換成你需要的 pubxml |
| 63 | + |
| 64 | + - name: Compress output |
| 65 | + run: | |
| 66 | + $tag = "${{ github.ref_name }}" |
| 67 | + $publishPath = Join-Path $PWD "VMSystem-publish" |
| 68 | + $zipPath = Join-Path $PWD "VMSystem-publish-$tag.zip" |
| 69 | + Compress-Archive -Path "$publishPath" -DestinationPath $zipPath -Force |
| 70 | +
|
| 71 | + - name: Create GitHub Release |
| 72 | + uses: softprops/action-gh-release@v2 |
| 73 | + with: |
| 74 | + body: | |
| 75 | + ## 🚀 What's Changed |
| 76 | + - something changed |
| 77 | +
|
| 78 | + ## 🐞 What's Fixed |
| 79 | + - something fixed |
| 80 | +
|
| 81 | + ## 📦 HeadCommit Message |
| 82 | +
|
| 83 | + ${{ github.event.head_commit.message }} |
| 84 | +
|
| 85 | + ## 🔗 Full Changelog |
| 86 | + ${{ github.server_url }}/${{ github.repository }}/compare/${{ github.event.release.tag_name }}^...${{ github.event.release.tag_name }} |
| 87 | +
|
| 88 | + files: VMSystem-publish-${{ github.ref_name }}.zip |
| 89 | + env: |
| 90 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
0 commit comments