-
Notifications
You must be signed in to change notification settings - Fork 8
63 lines (48 loc) · 1.57 KB
/
Copy pathdotnet.yml
File metadata and controls
63 lines (48 loc) · 1.57 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
55
56
57
58
59
60
61
62
63
# 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: .NET
on:
push:
branches: [ "master" ]
tags: [ "v*" ]
pull_request:
branches: [ "master" ]
workflow_dispatch:
permissions:
id-token: write
contents: read
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }} # checkout the correct branch name
fetch-depth: 0
- name: Install GitVersion
uses: gittools/actions/gitversion/setup@v0.9.7
with:
versionSpec: '5.x'
- name: Determine Version
uses: gittools/actions/gitversion/execute@v0.9.7
with:
useConfigFile: true
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 10.0.x
- name: Build
run: dotnet build --configuration Release -p:Version=$GITVERSION_NUGETVERSION
- name: Test
run: dotnet test --configuration Release --no-build --verbosity normal
- name: Pack
run: dotnet pack --no-build -o ./ -p:Version=$GITVERSION_NUGETVERSION
- name: NuGet login (OIDC → temporary API key)
if: startsWith(github.ref, 'refs/tags/v')
uses: NuGet/login@v1
id: login
with:
user: ${{ secrets.NUGET_USER }}
- name: Push
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
run: dotnet nuget push *.nupkg --api-key ${{steps.login.outputs.NUGET_API_KEY}} --source https://api.nuget.org/v3/index.json