-
Notifications
You must be signed in to change notification settings - Fork 0
49 lines (35 loc) · 1.3 KB
/
release.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
name: Release & Package
# This workflow will build, test and package the library
# after any published released from a tagged branch.
# This should always be triggered after a merged Pull Request
# due to the branch protection rules in place.
on:
release:
types: [ published ]
# 'github.ref_name' will be tag in the event of a release e.g. v1.2.3
# Further down we use the :1 to substring and remove the 'v' as NuGet doesn't like it.
env:
RELEASE_VERSION: ${{ github.ref_name }}
permissions:
packages: write
jobs:
package:
name: Release and Package
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v3
- name: Setup .NET
uses: actions/setup-dotnet@v2
with:
dotnet-version: 8.0.x
- name: Restore dependencies
run: dotnet restore
- name: Build
run: dotnet build --configuration Release /p:Version=${RELEASE_VERSION:1} --no-restore
- name: Test
run: dotnet test --configuration Release /p:Version=${RELEASE_VERSION:1} --no-build
- name: Pack
run: dotnet pack --configuration Release /p:Version=${RELEASE_VERSION:1} --no-build --output .
- name: Push
run: dotnet nuget push **/*.nupkg --source "https://nuget.pkg.github.com/melittleman/index.json" --api-key ${{ secrets.GITHUB_TOKEN }}