-
Notifications
You must be signed in to change notification settings - Fork 1
133 lines (110 loc) · 4.75 KB
/
Create Release and Publish.yml
File metadata and controls
133 lines (110 loc) · 4.75 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
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:
prerelease: ${{ contains(github.ref_name, '-beta') || contains(github.ref_name, '-rc') }}
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.ref_name }}^...${{ github.ref_name }}
files: |
VMSystem-publish-${{ github.ref_name }}.zip
VMSystem-publish-${{ github.ref_name }}_patch.zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}