-
Notifications
You must be signed in to change notification settings - Fork 57
80 lines (68 loc) · 2.13 KB
/
buildAndDeploy.yaml
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
name: "Build and Deploy"
on:
push:
branches:
- release
paths-ignore:
- '**/*.md'
- '**/*.gitignore'
- '**/*.gitattributes'
workflow_dispatch:
branches:
- release
paths-ignore:
- '**/*.md'
- '**/*.gitignore'
- '**/*.gitattributes'
jobs:
build:
outputs:
version: ${{ steps.set_proj_version.outputs.PKG_VERSION }}
relnotes: ${{ steps.set_proj_version.outputs.RELNOTES }}
name: Build
runs-on: ubuntu-latest
env:
DOTNET_CLI_TELEMETRY_OPTOUT: 1
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1
DOTNET_NOLOGO: true
DOTNET_GENERATE_ASPNET_CERTIFICATE: false
DOTNET_ADD_GLOBAL_TOOLS_TO_PATH: false
DOTNET_MULTILEVEL_LOOKUP: 0
steps:
- uses: actions/checkout@v2
- name: Setup .NET Core SDK
uses: actions/[email protected]
with:
dotnet-version: 6.0.x
- name: Restore
run: dotnet restore
- name: Build
run: dotnet build --configuration Release --no-restore
- name: Test
run: dotnet test
- name: Pack
run: dotnet pack InstantAPIs/InstantAPIs.csproj --configuration Release -o finalpackage --no-build
- name: Publish artifact
uses: actions/upload-artifact@master
with:
name: nupkg
path: finalpackage
- name: Get version
id: set_proj_version
shell: pwsh
run: |
[xml]$nuspec = Get-Content InstantAPIs/InstantAPIs.csproj
$version=$nuspec.project.propertygroup.version
$relnotes=$nuspec.project.propertygroup.packagereleasenotes
echo "PKG_VERSION=$version" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append
echo "RELNOTES=$relnotes" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append
- name: Push to NuGet
run: dotnet nuget push **/*.nupkg -k ${{ secrets.NUGET_API_KEY }} -s https://api.nuget.org/v3/index.json --skip-duplicate
- name: Tag and Release
id: tag_release
uses: softprops/[email protected]
with:
body: ${{ env.RELNOTES }}
tag_name: ${{ env.PKG_VERSION }}
files: |
**/*.nupkg