-
Notifications
You must be signed in to change notification settings - Fork 4
112 lines (94 loc) · 3.42 KB
/
build.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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
name: CI
on:
push:
branches: master
tags-ignore: v=*
create:
tags: v=*
release:
types: [published]
tags: v=*
jobs:
build:
runs-on: ubuntu-latest
#runs-on: ubuntu-16.04
steps:
- name: checkout latest
uses: actions/checkout@v1
- name: extract version base
id: extract_version_base
shell: pwsh
env:
## set-env is no longer considered safe:
## https://github.blog/changelog/2020-10-01-github-actions-deprecating-set-env-and-add-path-commands/
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
run: |
## Need to run this once to get the dotnet init message out of the way
dotnet msbuild ./Versions.props /t:DumpVersions /nologo
$vdumpJson = dotnet msbuild ./Versions.props /t:DumpVersions /nologo
Write-Output "Got Version Dump JSON:"
Write-Output $vdumpJson
$vdump = $vdumpJson | ConvertFrom-Json
Write-Output "Got Version Dump:"
Write-Output $vdump
## Export as output and ENV VARS for subsequent steps
$versionBase = "$($vdump.Major).$($vdump.Minor).$($vdump.Patch)"
Write-Host "Found matching Tag Version info:"
Write-Host "::set-output name=version_base::$versionBase"
Write-Host "::set-env name=VERSION_BASE::$versionBase"
- name: compute build nums
uses: zyborg/gh-action-buildnum@v1
with:
gist_token: ${{ secrets.GIST_TOKEN }}
version_key: ${{ steps.extract_version_base.outputs.version_base }}
set_env: true
- name: compile & pack
shell: pwsh
run: |
dotnet build --configuration Release /p:VersionBuild=$env:BUILDNUM_FOR_VERSION
dotnet pack --configuration Release /p:VersionBuild=$env:BUILDNUM_FOR_VERSION
- name: upload package as artifact
if: startsWith(github.ref, 'refs/tags/v=')
uses: actions/upload-artifact@v1
with:
name: package
path: src/Zyborg.AWS.Lambda.Kerberos/bin/Release
push-nuget-preview:
needs: build
if: (github.event_name == 'create')
runs-on: ubuntu-latest
steps:
- name: download package from artifact
uses: actions/download-artifact@v1
with:
name: package
- name: setup nuget
uses: nuget/setup-nuget@v1
- name: register nuget repo
## As per:
## https://help.github.com/en/articles/configuring-nuget-for-use-with-github-package-registry
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
nuget sources Add -Name "GPR" \
-Source "https://nuget.pkg.github.com/ebekker/index.json" \
-UserName ebekker -Password $GITHUB_TOKEN
find . -name *.nupkg
nuget setapikey $GITHUB_TOKEN -Source "GPR"
- name: publish
run: nuget push package/Zyborg.AWS.Lambda.Kerberos*.nupkg -Source GPR
push-nuget-release:
needs: build
if: (github.event_name == 'release')
runs-on: ubuntu-latest
steps:
- name: download package from artifact
uses: actions/download-artifact@v1
with:
name: package
- name: setup nuget
uses: nuget/setup-nuget@v1
- name: publish
env:
NUGET_TOKEN: ${{ secrets.NUGET_TOKEN }}
run: nuget push package/Zyborg.AWS.Lambda.Kerberos*.nupkg -Source nuget.org -ApiKey $NUGET_TOKEN