-
Notifications
You must be signed in to change notification settings - Fork 30
43 lines (43 loc) · 1.73 KB
/
lib-publish-nuget-org.yml
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
name: Lib - Build and Push (Nuget.org)
on:
workflow_call:
secrets:
nuget-api-key:
description: 'The Nuget.org publish API key to push the Nuget package.'
required: true
inputs:
project-name:
description: 'The name of the project to build. Must match the directory name.'
required: true
type: string
base-path:
description: 'The working directory base path with a trailing forward-slash'
required: false
default: '/home/runner/work/${{ github.event.repository.name }}/${{ github.event.repository.name }}/'
type: string
source-path:
description: >
The source path relative to the base path with a trailing forward-slash.
For example, if the project folder is in a subfolder called src, then this value needs to be set to src/
If there is no subfolder, just leave it empty.
required: false
default: ''
type: string
jobs:
lib-publish-nuget:
runs-on: ubuntu-latest
steps:
- name: 🧑💻 Checkout codebase
uses: actions/checkout@v4
- name: 🥓 Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
5.0.x
6.0.x
7.0.x
8.0.x
- name: 🏗 Build, Pack and Publish to Nuget.org
run: |
dotnet pack ${{ inputs.base-path }}${{ inputs.source-path }}${{ inputs.project-name }}/${{ inputs.project-name }}.csproj --configuration Release -p:IncludeSymbols=true -p:SymbolPackageFormat=snupkg
dotnet nuget push ${{ inputs.base-path }}${{ inputs.source-path }}${{ inputs.project-name }}/bin/Release/*.nupkg --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.nuget-api-key }}