-
Notifications
You must be signed in to change notification settings - Fork 10
155 lines (129 loc) · 5.27 KB
/
Copy pathpublish.yml
File metadata and controls
155 lines (129 loc) · 5.27 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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
name: Publish
on:
workflow_dispatch:
jobs:
build-windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 10.0.x
- name: Build test apps (Client + Upgrade)
run: |
dotnet publish test_app/Client/ClientSample.csproj -c Release -r win-x64 -p:PublishSingleFile=true --self-contained -o prebuilt
dotnet publish test_app/Upgrade/UpgradeSample.csproj -c Release -r win-x64 -p:PublishSingleFile=true --self-contained -o prebuilt
- name: Publish Tools
run: >
dotnet publish src/GeneralUpdate.Tools.csproj
-c Release -r win-x64
-p:PublishSingleFile=true --self-contained
-p:IncludeNativeLibrariesForSelfExtract=true
-p:IncludeAllContentForSelfExtract=true
-o publish/win-x64
- name: Copy test apps into publish output
run: xcopy prebuilt\* publish\win-x64\test_app_exe\ /Y /I
- name: Upload
uses: actions/upload-artifact@v4
with:
name: win-x64
path: publish/win-x64/
build-linux:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 10.0.x
- name: Build test apps (Client + Upgrade)
run: |
dotnet publish test_app/Client/ClientSample.csproj -c Release -r linux-x64 -p:PublishSingleFile=true --self-contained -o prebuilt
dotnet publish test_app/Upgrade/UpgradeSample.csproj -c Release -r linux-x64 -p:PublishSingleFile=true --self-contained -o prebuilt
- name: Publish Tools
run: >
dotnet publish src/GeneralUpdate.Tools.csproj
-c Release -r linux-x64
-p:PublishSingleFile=true --self-contained
-p:IncludeNativeLibrariesForSelfExtract=true
-p:IncludeAllContentForSelfExtract=true
-o publish/linux-x64
- name: Copy test apps into publish output
run: mkdir -p publish/linux-x64/test_app_exe && cp prebuilt/* publish/linux-x64/test_app_exe/
- name: Upload
uses: actions/upload-artifact@v4
with:
name: linux-x64
path: publish/linux-x64/
release:
needs: [build-windows, build-linux]
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout for changelog
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Generate changelog
run: |
PREVIOUS_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "")
if [ -z "$PREVIOUS_TAG" ]; then
LOG=$(git log --oneline --no-decorate -100)
else
LOG=$(git log "${PREVIOUS_TAG}..HEAD" --oneline --no-decorate)
fi
FEATURES=""; FIXES=""; REFACTORS=""; TESTS=""; DOCS=""; CHORES=""; OTHERS=""
while IFS= read -r line; do
[ -z "$line" ] && continue
# Remove commit hash prefix
msg=$(echo "$line" | sed -E 's/^[a-f0-9]+ //')
case "$msg" in
feat:*|feature:*) FEATURES="${FEATURES}- ${msg}"$'\n' ;;
fix:*) FIXES="${FIXES}- ${msg}"$'\n' ;;
refactor:*) REFACTORS="${REFACTORS}- ${msg}"$'\n' ;;
test:*) TESTS="${TESTS}- ${msg}"$'\n' ;;
docs:*) DOCS="${DOCS}- ${msg}"$'\n' ;;
chore:*|cleanup:*|ci:*|build:*) CHORES="${CHORES}- ${msg}"$'\n' ;;
*) OTHERS="${OTHERS}- ${msg}"$'\n' ;;
esac
done <<< "$LOG"
BODY=""
append_section() {
if [ -n "$2" ]; then
BODY="${BODY}## $1"$'\n\n'"$2"$'\n'
fi
}
append_section "🚀 Features" "$FEATURES"
append_section "🐛 Bug Fixes" "$FIXES"
append_section "♻️ Refactoring" "$REFACTORS"
append_section "✅ Tests" "$TESTS"
append_section "📝 Documentation" "$DOCS"
append_section "🔧 Chores" "$CHORES"
append_section "📦 Other Changes" "$OTHERS"
[ -z "$BODY" ] && BODY="_No changes detected between tags._"
echo "$BODY" > changelog.md
echo "=== Generated changelog ==="
cat changelog.md
- uses: actions/download-artifact@v4
- name: Get timestamp
id: ts
run: echo "timestamp=$(date -u '+%Y%m%d%H%M%S')" >> $GITHUB_OUTPUT
- name: Package win
working-directory: win-x64
run: zip ../GeneralUpdate.Tools_${{ steps.ts.outputs.timestamp }}_win-x64.zip -r *
- name: Package linux
working-directory: linux-x64
run: |
chmod +x *
zip ../GeneralUpdate.Tools_${{ steps.ts.outputs.timestamp }}_linux-x64.zip -r *
- name: Create Release
uses: softprops/action-gh-release@v2
with:
tag_name: v${{ steps.ts.outputs.timestamp }}
name: GeneralUpdate.Tools ${{ steps.ts.outputs.timestamp }}
body_path: changelog.md
files: |
GeneralUpdate.Tools_${{ steps.ts.outputs.timestamp }}_win-x64.zip
GeneralUpdate.Tools_${{ steps.ts.outputs.timestamp }}_linux-x64.zip