-
Notifications
You must be signed in to change notification settings - Fork 0
95 lines (90 loc) · 2.83 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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
# This workflow is triggered when a tag is pushed to master branch
# It will:
# - Build the project and generate a nuget package
# - Publish it to Github Packages and Nuget.org Packages repositories
# - Create a Github release
on:
push:
# Sequence of patterns matched against refs/tags
tags:
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10
name: Release
jobs:
build:
name: Build package
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: 3.1.302
- name: Build project
run: dotnet build -c Release
- name: Generate package
run: |
dotnet pack --no-build --include-symbols -c Release -o .build/nuget -p:RepositoryBranch=${{github.ref}} -p:RepositoryCommit=${{github.sha}}
- name: Upload Build Artifact
uses: actions/upload-artifact@v2
with:
name: packages
path: .build/nuget
publish-to-github:
name: Publish to Github
needs: build
runs-on: ubuntu-latest
env:
NUGET_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: 3.1.302
source-url: https://nuget.pkg.github.com/PulsarBlow/index.json
- name: Download Build Artifact
uses: actions/download-artifact@v2
with:
name: packages
path: .
- name: Publish package
run: |
dotnet nuget push *.nupkg --skip-duplicate
publish-to-nuget:
name: Publish to NuGet
needs: build
runs-on: ubuntu-latest
env:
NUGET_AUTH_TOKEN: ${{ secrets.NUGET_TOKEN }}
steps:
- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: 3.1.302
- name: Download Build Artifact
uses: actions/download-artifact@v2
with:
name: packages
path: .
- name: Publish package
run: |
dotnet nuget push *.nupkg -k $NUGET_AUTH_TOKEN -sk $NUGET_AUTH_TOKEN --skip-duplicate -s https://api.nuget.org/v3/index.json
create-github-release:
name: Create Github release
needs: [ publish-to-github, publish-to-nuget ]
runs-on: ubuntu-latest
steps:
- name: Create Release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Automaticaly provided by Github workflow
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
body: |
Changes in this Release
- First Change
- Second Change
draft: false
# Prerelease if tag contains `-` character
prerelease: ${{ contains(github.ref, '-') }}