-
Notifications
You must be signed in to change notification settings - Fork 0
52 lines (43 loc) · 1.32 KB
/
ci.yml
File metadata and controls
52 lines (43 loc) · 1.32 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
name: Build, Test, Publish
on:
push:
branches:
- main
workflow_dispatch:
inputs:
publish:
description: 'Publish NuGet package?'
required: false
default: 'false'
jobs:
build-and-publish:
runs-on: windows-latest
env:
PROJECT_NAME: StringEnums
steps:
- uses: actions/checkout@v6
- uses: actions/setup-dotnet@v4
with:
dotnet-version: "8.0.x"
- name: Restore
run: dotnet restore ${{ env.PROJECT_NAME }}.slnx
- name: Build
run: dotnet build ${{ env.PROJECT_NAME }}.slnx `
--configuration Release --no-restore
- name: Test
run: dotnet test ${{ env.PROJECT_NAME }}.slnx `
--configuration Release --no-build
- name: Pack
run: dotnet pack ${{ env.PROJECT_NAME }}/${{ env.PROJECT_NAME }}.csproj `
--configuration Release `
--no-restore --no-build `
-o ./artifacts
- name: List artifacts
run: ls ./artifacts
- name: Publish to NuGet
if: github.event.inputs.publish == 'true'
run: |
$pkg = Get-ChildItem ./artifacts/*.nupkg | Select-Object -First 1
dotnet nuget push $pkg.FullName `
--api-key ${{ secrets.NUGET_API_KEY }} `
--source https://api.nuget.org/v3/index.json