-
-
Notifications
You must be signed in to change notification settings - Fork 9
56 lines (46 loc) · 1.51 KB
/
publish.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
44
45
46
47
48
49
50
51
52
53
54
55
56
name: Nuget Publish
on:
workflow_dispatch:
inputs:
version:
description: version
required: true
type: string
jobs:
publish-to-nuget:
runs-on: ubuntu-latest
steps:
- name: version pattern
id: check-version
run: |
version="${{ github.event.inputs.version }}"
if [[ $version =~ [0-9]+\.[0-9]+\.[0-9]+ ]]; then
echo "Input matches pattern: $version"
else
echo "Input does not match pattern: $version"
exit 1
fi
- name: version check
if: success()
run: echo ok
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0 # Get all history to allow automatic versioning using MinVer
submodules: recursive
- name: Setup Dotnet
uses: actions/setup-dotnet@v4
with:
dotnet-version: '9.x'
- name: restore dependencies
run: dotnet restore
- name: Build
run: dotnet build -c Release --no-restore
- name: Test
run: dotnet test -c Release --no-build --verbosity normal
- name: Pack
run: dotnet pack -p:PackageVersion=${{ github.event.inputs.version }} -c Release --nologo --output working-nuget
- name: Publish the package to nuget.org
run: dotnet nuget push ./working-nuget/*.nupkg -k $NUGET_AUTH_TOKEN -s https://api.nuget.org/v3/index.json
env:
NUGET_AUTH_TOKEN: ${{ secrets.NUGET_TOKEN }}