-
Notifications
You must be signed in to change notification settings - Fork 16
52 lines (47 loc) · 1.46 KB
/
dotnet.yml
File metadata and controls
52 lines (47 loc) · 1.46 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
# This workflow will build a .NET project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net
name: Publish Package To Nuget
on:
push:
tags:
- 'v*.*.*'
jobs:
build:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
6.0.x
8.0.x
- name: Restore dependencies
run: dotnet restore
- name: Build
run: dotnet build --no-restore
- name: Test
run: dotnet test --no-build --verbosity normal
- name: Change Package Version
shell: pwsh
env:
TagVersion: ${{github.ref_name}}
run: |
$content = './HomeKit.Net/HomeKit.Net.csproj'
$xmldata = [xml](Get-Content $content)
$Version = $env:TagVersion -replace '^v'
$node = $xmldata.Project.PropertyGroup
$node.Version = $Version
$xmldata.Save($content)
- name: Package
run: |
dotnet build -c Release .\HomeKit.Net\HomeKit.Net.csproj
- name: Upload to Nuget
shell: pwsh
env:
APIKEY: ${{ secrets.APIKEY }}
TagVersion: ${{github.ref_name}}
run: |
$Version = $env:TagVersion -replace '^v'
$FullPath = "HomeKit.Net/bin/Release/HomeKit.Net.{0}.nupkg" -f $Version
dotnet nuget push $FullPath --api-key $env:APIKEY --source https://api.nuget.org/v3/index.json