-
Notifications
You must be signed in to change notification settings - Fork 0
58 lines (46 loc) · 1.66 KB
/
release.yml
File metadata and controls
58 lines (46 loc) · 1.66 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
56
57
58
name: Publish NuGet package
on:
workflow_dispatch:
inputs:
publishPreRelease:
description: 'Publish pre-release'
type: boolean
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 10.0.x
- name: Install GitVersion
uses: gittools/actions/gitversion/setup@v3.2.1
with:
versionSpec: '6.3.x'
- name: Determine version
id: version_step
uses: gittools/actions/gitversion/execute@v3.2.1
- name: Set package version
run: |
version=${{ steps.version_step.outputs.majorMinorPatch }}
preRelease=${{ steps.version_step.outputs.preReleaseTag }}
if [ "${{ inputs.publishPreRelease }}" == "true" ]; then
echo "PACKAGE_VERSION=$version-pre.${{ steps.version_step.outputs.preReleaseNumber }}" >> $GITHUB_ENV
else
echo "PACKAGE_VERSION=$version" >> $GITHUB_ENV
fi
- name: Restore
run: dotnet restore
- name: Build
run: dotnet build -c Release /p:Version=${PACKAGE_VERSION}
- name: Test
run: dotnet test -c Release /p:Version=${PACKAGE_VERSION} --no-restore --verbosity normal
- name: Pack
run: dotnet pack -c Release /p:Version=${PACKAGE_VERSION} --no-restore --output .
- name: Push
run: dotnet nuget push OldBit.Spectron.Files.${PACKAGE_VERSION}.nupkg --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.NUGET_KEY }}