-
Notifications
You must be signed in to change notification settings - Fork 33
49 lines (47 loc) · 1.48 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
on:
push:
tags:
- "[0-9]+.[0-9]+.[0-9]+"
jobs:
build:
runs-on: windows-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v2
- name: Setup .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: 8.0.x
- name: Set up NuGet
uses: nuget/setup-nuget@v1
with:
nuget-version: '6.x'
- name: Verify commit exists in origin/master
run: |
git fetch --no-tags --prune --depth=1 origin +refs/heads/*:refs/remotes/origin/*
git branch --remote --contains | grep origin/${env:RELEASE_BRANCH}
env:
RELEASE_BRANCH: master
- name: Restore dependencies
run: |
cd mzLib
dotnet restore
- name: Build
run: |
$version= &git describe --tags
cd mzLib
dotnet build --no-restore --configuration Release /p:Version=${version}
- name: Test
run: |
$version= &git describe --tags
cd mzLib
dotnet test --configuration Release /p:Version=${version} --no-build
- name: Pack and Push NuGet Package
run: |
$version= &git describe --tags
cd mzLib
nuget pack mzLib.nuspec -Version ${version} -Properties Configuration=Release
dotnet nuget push mzLib.${version}.nupkg --source https://api.nuget.org/v3/index.json --api-key ${env:GITHUB_TOKEN}
env:
GITHUB_TOKEN: ${{ secrets.NUGET_KEY }}