forked from microsoft/WPFDXInterop
-
Notifications
You must be signed in to change notification settings - Fork 0
73 lines (61 loc) · 2.57 KB
/
publish-nuget.yaml
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
name: publish
on:
push:
branches:
- master
tags:
- "*"
jobs:
build-and-publish-nuget:
name: build and publish nuget
runs-on: windows-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0 # get full History to make sure tags are included an thus git-describe works
- name: Get version number
id: version
uses: PaulHatch/[email protected]
- name: Generate semver version number
id: generate-version
shell: powershell
run: |
if("${{ steps.version.outputs.is_tagged }}" -eq "false")
{
$semver_version = "${{ steps.version.outputs.major }}.${{ steps.version.outputs.minor }}.${{ steps.version.outputs.patch }}-beta.${{ steps.version.outputs.increment }}"
}
else
{
$semver_version = "${{ steps.version.outputs.major }}.${{ steps.version.outputs.minor }}.${{ steps.version.outputs.patch }}"
}
$assembly_version = "${{ steps.version.outputs.major }}.${{ steps.version.outputs.minor }}.${{ steps.version.outputs.patch }}.${{ steps.version.outputs.increment }}"
echo assembly-version=${assembly_version} >> $env:GITHUB_OUTPUT
echo semantic-version=${semver_version} >> $env:GITHUB_OUTPUT
- uses: nuget/setup-nuget@v1
with:
nuget-api-key: ${{ secrets.GITHUB_TOKEN }}
nuget-version: "6.x"
- name: Setup .NET Core @ Latest
uses: actions/setup-dotnet@v3
with:
source-url: https://nuget.pkg.github.com/renewedvision/index.json
env:
NUGET_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
- name: Add msbuild to PATH
uses: microsoft/[email protected]
- name: Build
id: build
shell: powershell
run: |
msbuild src/RenewedVision.Wpf.Interop.DirectX.sln -restore -p:RestorePackagesConfig=true -p:Version="${{ steps.generate-version.outputs.semantic-version }}" -p:AssemblyVersion="${{ steps.generate-version.outputs.assembly-version }}" -t:Rebuild -p:Configuration=Release
- name: Package
id: package
run: |
nuget pack ./RenewedVision.Wpf.Interop.DirectX.nuspec -Version ${{ steps.generate-version.outputs.semantic-version }} -Properties NuGetBinaries=src\x64\release
- name: Publish Nuget to GitHub registry
shell: powershell
run: |
foreach($file in (Get-ChildItem . -Recurse -Include *.nupkg)) {
dotnet nuget push $file --skip-duplicate
}