This repository was archived by the owner on Apr 17, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
54 lines (44 loc) · 1.52 KB
/
dotnet-nuget.yml
File metadata and controls
54 lines (44 loc) · 1.52 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
54
# 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: Build and Pack on Nuget
on:
push:
branches: [ main ]
paths: [ 'src/NET6CustomLibrary/**' ]
workflow_dispatch:
env:
NET_VERSION: '6.x'
PROJECT_NAME: src/NET6CustomLibrary
PROJECT_FILE: NET6CustomLibrary.csproj
RELEASE_NAME: NET6CustomLibrary
jobs:
build:
name: Publish
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup .NET Core SDK ${{ env.NET_VERSION }}
uses: actions/setup-dotnet@v3
with:
dotnet-version: ${{ env.NET_VERSION }}
- name: Nerdbank.GitVersioning
uses: dotnet/nbgv@v0.4
id: nbgv
with:
path: ${{ env.PROJECT_NAME }}
- name: Package
run: dotnet pack -c Release -o . '${{ env.PROJECT_NAME }}/${{ env.PROJECT_FILE }}' -p:Version=${{ steps.gitversion.outputs.SemVer }}
- name: Publish on NuGet
run: dotnet nuget push *.nupkg -k ${{ secrets.NUGET_API_KEY }} -s https://api.nuget.org/v3/index.json --no-symbols --skip-duplicate
- name: Create release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ steps.nbgv.outputs.NuGetPackageVersion }}
release_name: ${{ env.RELEASE_NAME }} ${{ steps.nbgv.outputs.NuGetPackageVersion }}
draft: false
prerelease: false