Skip to content

Commit c36534b

Browse files
committed
Create dotnet-release.yml
1 parent ecca46d commit c36534b

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed

.github/workflows/dotnet-release.yml

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: 'Build and Release'
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*.*.*'
7+
8+
jobs:
9+
build-windows:
10+
11+
runs-on: windows-latest
12+
13+
steps:
14+
- uses: actions/checkout@v4
15+
- name: Setup .NET 8.0
16+
uses: actions/setup-dotnet@v4
17+
with:
18+
dotnet-version: 8.0.x
19+
- name: Restore dependencies
20+
working-directory: ./src
21+
run: dotnet restore
22+
- name: Build
23+
working-directory: ./src
24+
run: dotnet build --configuration Release --no-restore /p:NoWarn=1591
25+
- name: Build project
26+
run: |
27+
dotnet publish ./src/Nager.FineDustSensor.SensorControl/Nager.FineDustSensor.SensorControl.csproj --configuration Release --self-contained false --runtime win-x64 -p:PublishReadyToRun=true -p:PublishSingleFile=true --output ./publish/temp
28+
- uses: vimtor/[email protected]
29+
with:
30+
files: ./publish/temp
31+
dest: ./publish/Nager.FineDustSensor.SensorControl.zip
32+
- name: Get the version
33+
id: get_version
34+
run: echo ::set-output name=tag::${GITHUB_REF/refs\/tags\//}
35+
shell: bash
36+
- name: Upload binaries to release
37+
uses: svenstaro/upload-release-action@v2
38+
with:
39+
repo_name: nager/Nager.FineDustSensor
40+
repo_token: ${{ secrets.GITHUB_TOKEN }}
41+
file: ./publish/Nager.FineDustSensor.SensorControl.zip
42+
tag: ${{ steps.get_version.outputs.tag }}
43+
overwrite: true

0 commit comments

Comments
 (0)