Skip to content

Commit a7d1f39

Browse files
authored
Create dotnet-publish.yml
1 parent edebd2f commit a7d1f39

1 file changed

Lines changed: 49 additions & 0 deletions

File tree

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# https://docs.microsoft.com/en-us/azure/devops/artifacts/quickstarts/github-actions?view=azure-devops
2+
name: Publish NuGet package
3+
4+
on:
5+
push:
6+
tags:
7+
- 'v*.*.*'
8+
workflow_dispatch:
9+
10+
env:
11+
ARTIFACTS_FEED_URL: https://api.nuget.org/v3/index.json
12+
BUILD_CONFIGURATION: "Release"
13+
DOTNET_VERSION: "6.x"
14+
15+
jobs:
16+
build-and-deploy:
17+
runs-on: ubuntu-latest
18+
steps:
19+
- name: Checkout
20+
uses: actions/checkout@v2
21+
with:
22+
fetch-depth: 0 # Needed for GitVersion to function correctly
23+
24+
- name: Setup .NET
25+
uses: actions/setup-dotnet@v1
26+
with:
27+
dotnet-version: ${{ env.DOTNET_VERSION }}
28+
source-url: ${{ env.ARTIFACTS_FEED_URL }}
29+
env:
30+
NUGET_AUTH_TOKEN: ${{ secrets.NUGET_API_KEY_NEOLUTION }}
31+
32+
- name: Install GitVersion
33+
uses: gittools/actions/gitversion/setup@v0.9.7
34+
with:
35+
versionSpec: '5.x'
36+
37+
- name: Determine version number
38+
uses: gittools/actions/gitversion/execute@v0.9.7
39+
40+
- name: Build and pack
41+
run: |
42+
dotnet restore
43+
dotnet build --configuration '${{ env.BUILD_CONFIGURATION }}' -p:Version=$GITVERSION_NUGETVERSION
44+
dotnet pack 'Neolution.DotNet.Console\Neolution.DotNet.Console.csproj' --configuration '${{ env.BUILD_CONFIGURATION }}' --no-build -p:PackageVersion=$GITVERSION_NUGETVERSION
45+
46+
- name: Push NuGet package
47+
run: dotnet nuget push --skip-duplicate -k $NUGET_AUTH_TOKEN **/bin/Release/*.nupkg
48+
env:
49+
NUGET_AUTH_TOKEN: ${{ secrets.NUGET_API_KEY_NEOLUTION }}

0 commit comments

Comments
 (0)