-
Notifications
You must be signed in to change notification settings - Fork 12
79 lines (68 loc) · 2.38 KB
/
manual.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
name: Manual
on:
workflow_dispatch:
# Inputs the workflow accepts.
inputs:
versionSuffix:
description: 'Version suffix'
required: false
default: ''
jobs:
build:
timeout-minutes: 15
runs-on: 'windows-2022'
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: versionSuffix
shell: pwsh
run: |
$versionSuffix = '${{ github.event.inputs.versionSuffix }}'
If([string]::IsNullOrEmpty($versionSuffix))
{
$versionSuffix = '${{ github.ref_name }}'
}
$versionSuffix = '-' + ($versionSuffix -replace '[^a-zA-Z0-9]','-')
If($versionSuffix -eq '-release')
{
$versionSuffix = ''
}
If(('-', '-master', '-main') -eq $versionSuffix)
{
$versionSuffix = '-prerelease'
}
echo "versionSuffix=$versionSuffix" | Out-File -FilePath $Env:GITHUB_ENV -Append
- name: Get version number
shell: pwsh
run: |
If([string]::IsNullOrEmpty({{ env.versionSuffix }}))
{
# No suffix. Fine.
$versionNumber = Get-Date -Format "yy.M.${{ github.run_number }}"
}
else
{
# Suffix; ensure we add .0 in version number to stop them appearing above full releases.
$versionNumber = Get-Date -Format "yy.M.0.${{ github.run_number }}"
}
echo "versionNumber=$versionNumber${{ env.versionSuffix }}" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append
- name: Setup MSBuild path
uses: microsoft/[email protected]
with:
vs-version: '[17.0,)'
- name: Setup dot net
uses: actions/setup-dotnet@v3
with:
dotnet-version: |
3.1.x
5.0.x
6.0.x
7.0.x
8.0.x
- name: Build with dotnet
run: dotnet build ./MFaaP.MFWSClient/MFaaP.MFWSClient.csproj --configuration Release -p:Version=${{ env.versionNumber }}
- name: Create nuget package
run: dotnet pack ./MFaaP.MFWSClient/MFaaP.MFWSClient.csproj --configuration Release -p:Version=${{ env.versionNumber }}
- name: Push with dotnet
run: dotnet nuget push ./MFaaP.MFWSClient/bin/Release/MFaaP.MFWSClient.${{ env.versionNumber }}.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate