-
Notifications
You must be signed in to change notification settings - Fork 0
61 lines (49 loc) · 1.76 KB
/
Copy pathrelease.yml
File metadata and controls
61 lines (49 loc) · 1.76 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
name: Release
on:
push:
tags:
- 'v*.*.*'
workflow_dispatch:
inputs:
publish:
description: Publish to NuGet when NUGET_API_KEY is configured.
required: true
default: false
type: boolean
permissions:
contents: read
jobs:
package:
name: Build, test, pack, and publish
runs-on: ubuntu-latest
env:
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- name: Restore
run: dotnet restore Termii.SDK.sln
- name: Build
run: dotnet build Termii.SDK.sln --configuration Release --no-restore
- name: Unit tests
run: dotnet test tests/Termii.Tests/Termii.Tests.csproj --configuration Release --no-build --logger "trx;LogFileName=unit-tests.trx"
- name: Integration tests
run: dotnet test tests/Termii.IntegrationTests/Termii.IntegrationTests.csproj --configuration Release --no-build --logger "trx;LogFileName=integration-tests.trx"
- name: Pack
run: dotnet pack src/Termii/Termii.csproj --configuration Release --no-build --output artifacts/packages
- name: Upload package artifact
uses: actions/upload-artifact@v4
with:
name: nuget-package
path: |
artifacts/packages/*.nupkg
artifacts/packages/*.snupkg
- name: Publish to NuGet
if: ${{ (github.event_name == 'push' || inputs.publish) && env.NUGET_API_KEY != '' }}
run: dotnet nuget push "artifacts/packages/*.nupkg" --source https://api.nuget.org/v3/index.json --api-key "$NUGET_API_KEY" --skip-duplicate