-
Notifications
You must be signed in to change notification settings - Fork 11
55 lines (47 loc) · 1.74 KB
/
dotnet-publish.yml
File metadata and controls
55 lines (47 loc) · 1.74 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
name: Publish [.NET Core]
on:
push:
tags:
- v*
jobs:
publish:
name: Publish
runs-on: ubuntu-latest
steps:
# Build library and run tests
- uses: actions/checkout@v3
- name: Setup .NET
uses: actions/setup-dotnet@v3.0.0
with:
dotnet-version: |
8.0.x
- name: Install dependencies
run: dotnet restore
- name: Build
run: dotnet build --configuration Release --no-restore
- name: Test
run: dotnet test --no-restore --verbosity normal
# Set up environment variables
# The version number can be extracted from the currently checked out tag,
# which has the format 'refs/tags/v*'.
- name: Extract version number
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
# Create the NuGet package
# Note that we substr the release version to get the numbers only, without
# the 'v' prefix.
- name: Pack binary
run: dotnet pack --configuration Release --no-restore -p:PackageVersion=${RELEASE_VERSION:1} Bearded.Graphics/Bearded.Graphics.csproj
# Create a GitHub release
- name: Create a Release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ env.RELEASE_VERSION }}
name: Release ${{ env.RELEASE_VERSION }}
draft: false
prerelease: ${{ contains(env.RELEASE_VERSION, '-') }}
generate_release_notes: true
token: ${{ secrets.GITHUB_TOKEN }}
files: "**/*.nupkg"
# Push the NuGet package to the package providers
- name: Push release to NuGet
run: dotnet nuget push **/*.nupkg --source https://api.nuget.org/v3/index.json -k ${{ secrets.NUGET_API_KEY }} --skip-duplicate