Skip to content
This repository was archived by the owner on Apr 17, 2025. It is now read-only.

Commit a6cb509

Browse files
committed
2 parents f637201 + d6d5d3e commit a6cb509

File tree

1 file changed

+54
-0
lines changed

1 file changed

+54
-0
lines changed

.github/workflows/dotnet.yml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# This workflow will build a .NET project
2+
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net
3+
4+
name: Publish
5+
6+
on:
7+
push:
8+
branches: [ main ]
9+
paths: [ 'src/NET6CustomLibrary/**' ]
10+
workflow_dispatch:
11+
12+
env:
13+
NET_VERSION: '6.x'
14+
PROJECT_NAME: src/NET6CustomLibrary
15+
PROJECT_FILE: NET6CustomLibrary.csproj
16+
RELEASE_NAME: NET6CustomLibrary
17+
18+
jobs:
19+
build:
20+
name: Publish
21+
runs-on: ubuntu-latest
22+
23+
steps:
24+
- name: Checkout
25+
uses: actions/checkout@v3
26+
with:
27+
fetch-depth: 0
28+
29+
- name: Setup .NET Core SDK ${{ env.NET_VERSION }}
30+
uses: actions/setup-dotnet@v3
31+
with:
32+
dotnet-version: ${{ env.NET_VERSION }}
33+
34+
- name: Nerdbank.GitVersioning
35+
uses: dotnet/[email protected]
36+
id: nbgv
37+
with:
38+
path: ${{ env.PROJECT_NAME }}
39+
40+
- name: Package
41+
run: dotnet pack -c Release -o . '${{ env.PROJECT_NAME }}/${{ env.PROJECT_FILE }}'
42+
43+
- name: Publish on NuGet
44+
run: dotnet nuget push *.nupkg -k ${{ secrets.NUGET_API_KEY }} -s https://api.nuget.org/v3/index.json
45+
46+
- name: Create release
47+
uses: actions/create-release@v1
48+
env:
49+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
50+
with:
51+
tag_name: v${{ steps.nbgv.outputs.NuGetPackageVersion }}
52+
release_name: ${{ env.RELEASE_NAME }} ${{ steps.nbgv.outputs.NuGetPackageVersion }}
53+
draft: false
54+
prerelease: false

0 commit comments

Comments
 (0)