-
Notifications
You must be signed in to change notification settings - Fork 0
68 lines (55 loc) · 2.36 KB
/
Copy pathrelease.yml
File metadata and controls
68 lines (55 loc) · 2.36 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
64
65
66
67
68
name: Release
on:
push:
tags: ['v*']
env:
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
DOTNET_CLI_TELEMETRY_OPTOUT: true
DOTNET_NOLOGO: true
permissions:
contents: write
packages: write
jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
with:
fetch-depth: 0
- uses: actions/setup-dotnet@v5
with:
dotnet-version: '10.0.x'
- name: Extract version
id: version
run: echo "VERSION=${GITHUB_REF_NAME#v}" >> $GITHUB_OUTPUT
- name: Restore
run: dotnet restore Bowire.Protocol.Udp.slnx
- name: Build & Test
run: |
dotnet build Bowire.Protocol.Udp.slnx -c Release --no-restore -p:Version=${{ steps.version.outputs.VERSION }}
dotnet test Bowire.Protocol.Udp.slnx -c Release --no-build -v normal
- name: Pack
run: dotnet pack Bowire.Protocol.Udp.slnx -c Release --no-build -o artifacts/packages -p:Version=${{ steps.version.outputs.VERSION }}
# Gated on non-RC tags so `v*-rc*` exercises the full pipeline as
# a dry run without permanently publishing a package version.
# GA tags (no `-rc` suffix) push for real.
- name: Publish to GitHub Packages
if: ${{ !contains(github.ref, '-rc') }}
run: dotnet nuget push "artifacts/packages/*.nupkg" --source "https://nuget.pkg.github.com/Kuestenlogik/index.json" --api-key ${{ secrets.GITHUB_TOKEN }} --skip-duplicate
# nuget.org: only on real GA tags (no -rc), and only when the
# secret is configured. NUGET_API_KEY needs the
# 'Push new packages and package versions' scope with glob 'KL.*'.
- name: Publish to nuget.org
if: ${{ !contains(github.ref, '-rc') && env.NUGET_API_KEY != '' }}
env:
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
# No separate .snupkg push — Directory.Build.props uses
# DebugType=embedded so debug info ships inside the .nupkg.
run: |
dotnet nuget push "artifacts/packages/*.nupkg" --source https://api.nuget.org/v3/index.json --api-key "$NUGET_API_KEY" --skip-duplicate
- name: Create GitHub Release
uses: softprops/action-gh-release@v3
with:
generate_release_notes: true
prerelease: ${{ contains(github.ref, '-rc') }}
files: artifacts/packages/*.nupkg