-
Notifications
You must be signed in to change notification settings - Fork 27
50 lines (41 loc) · 1.53 KB
/
dotnet-publish-main.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
# 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 Publish (NuGet)
on:
push:
branches: ["main"]
paths:
- "src/**"
env:
DOTNET_VERSION: 8.0.x
jobs:
publish-github-packages:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
attestations: write
id-token: write
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
- name: Restore dependencies
run: dotnet restore
working-directory: src
- name: Build release packages
run: dotnet build --no-restore -c Release
working-directory: src
- name: Publish NuGet package CSnakes
run: dotnet pack src/CSnakes --no-build -c Release -o ./nuget -p:VersionSuffix='beta.${{ github.run_number }}'
- name: Publish NuGet package CSnakes.Runtime
run: dotnet pack src/CSnakes.Runtime --no-build -c Release -o ./nuget -p:VersionSuffix='beta.${{ github.run_number }}'
- name: Publish NuGet packages as artifacts
uses: actions/upload-artifact@v4
with:
name: nuget-packages
path: ./nuget
- name: Publish to GitHub packages
run: dotnet nuget push ./nuget/*.nupkg --source "https://api.nuget.org/v3/index.json" --api-key ${{ secrets.NUGET_API_KEY }}