-
Notifications
You must be signed in to change notification settings - Fork 2
54 lines (44 loc) · 1.41 KB
/
Copy pathbuild.yml
File metadata and controls
54 lines (44 loc) · 1.41 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
name: Build and Package .NET App
on:
push:
tags:
- v*
jobs:
build:
runs-on: windows-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: '10.0.x'
- name: Restore dependencies
run: dotnet restore
- name: Publish Windows build
run: dotnet publish -c Release -r win-x64 -o publish
- name: Archive build output
run: Compress-Archive -Path publish\* -DestinationPath win-x64.zip
- name: Generate changelog
id: changelog
run: |
$previousTag=$(git describe --tags --abbrev=0 HEAD^ 2>$null || echo "")
if [ -z "$previousTag" ]; then
echo "## Changes since beginning" > RELEASE_NOTES.md
git log --pretty=format:"- %s" >> RELEASE_NOTES.md
else
echo "## Changes since $previousTag" > RELEASE_NOTES.md
git log $previousTag..HEAD --pretty=format:"- %s" >> RELEASE_NOTES.md
fi
echo "notes<<EOF" >> $GITHUB_OUTPUT
cat RELEASE_NOTES.md >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
- name: Upload Release Asset
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: win-x64.zip
generate_release_notes: true
body: ${{ steps.changelog.outputs.notes }}