-
Notifications
You must be signed in to change notification settings - Fork 0
50 lines (39 loc) · 1.34 KB
/
Copy pathpublish-main.yml
File metadata and controls
50 lines (39 loc) · 1.34 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
name: Publish FluentPipelines to NuGet
on:
push:
tags:
- main-v[0-9]+.[0-9]+.[0-9]+
- main-v[0-9]+.[0-9]+.[0-9]+-*
env:
PROJECT_FILE: ./FluentPipelines/FluentPipelines.csproj
jobs:
BuildAndTest:
runs-on: ubuntu-latest
steps:
- name: Git checkout
uses: actions/checkout@v6
- name: Setup .NET
uses: actions/setup-dotnet@v5
with:
dotnet-version: 10.0.x
- name: Restore dependencies
run: dotnet restore
- name: Build
run: dotnet build $PROJECT_FILE -c Release --no-restore
- name: Test
run: dotnet test $PROJECT_FILE --no-build --verbosity normal
Publish:
needs: [BuildAndTest]
runs-on: ubuntu-latest
if: (github.ref_type == 'tag')
steps:
- name: Git checkout
uses: actions/checkout@v6
- name: Setup .NET
uses: actions/setup-dotnet@v5
with:
dotnet-version: 10.0.x
- name: Package project
run: dotnet pack $PROJECT_FILE -c Release "/p:PackageOutputPath=$GITHUB_WORKSPACE/artifacts" "/p:Version=${GITHUB_REF_NAME##main-v}" /p:RepositoryCommit=$GITHUB_SHA "/p:Authors=Visual Vincent"
- name: Publish NuGet package
run: dotnet nuget push "$GITHUB_WORKSPACE/artifacts/*.nupkg" --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.NUGET_API_KEY }}