-
Notifications
You must be signed in to change notification settings - Fork 41
46 lines (35 loc) · 1.39 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
# This workflow is run when releasing and is responsible for packing and pushing Nuget updates
name: Release
on:
release:
types: [ published ]
branches: [ main ]
jobs:
build:
runs-on: windows-2022
steps:
- uses: actions/checkout@v2
# Set up MSBuild in PATH for command
- name: Setup MSBuild in PATH
uses: microsoft/setup-msbuild@v1
- uses: actions/setup-dotnet@v1
with:
dotnet-version: '6.0.x'
# Get NuGet setup for restoring, packaging and pushing
- name: Setup NuGet
uses: NuGet/setup-nuget@v1.0.5
- name: Restore packages with NuGet
run: nuget restore Unleash.sln
# Get the versioning build variables in place
- name: Set versioning build variables
env:
NUGET_VERSION: ${{ github.event.release.tag_name }}
run: |
echo "nuget=${NUGET_VERSION}" >> $GITHUB_ENV
echo "file=${NUGET_VERSION%-beta*}" >> $GITHUB_ENV
echo "assembly=${NUGET_VERSION%-beta*}" >> $GITHUB_ENV
shell: bash
- name: Build the solution
run: msbuild Unleash.sln /p:Configuration=Release /p:Version=${{ env.nuget }} /p:FileVersion=${{ env.file }} /p:AssemblyVersion=${{ env.assembly }}
- name: Publish package
run: nuget push **\Unleash.Client.*.nupkg -Source 'https://api.nuget.org/v3/index.json' -ApiKey ${{ secrets.NUGET_API_KEY }}