-
Notifications
You must be signed in to change notification settings - Fork 96
99 lines (93 loc) · 2.84 KB
/
dotnetcore.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
name: .NET Core
env:
# Stop wasting time caching packages
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
# Disable sending usage data to Microsoft
DOTNET_CLI_TELEMETRY_OPTOUT: true
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
build:
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
- name: Setup .NET Core
uses: actions/setup-dotnet@v3
with:
dotnet-version: |
8.0.x
7.0.x
- name: Restore
run: git submodule update --init --recursive
- name: Build with dotnet
run: dotnet build build.proj --configuration Release
- name: Set Timezone
uses: szenius/set-timezone@v1.2
with:
timezoneWindows: "Nepal Standard Time"
- name: Test with dotnet
run: dotnet test build.proj -v n
package:
runs-on: windows-latest
permissions:
packages: write
contents: read
steps:
- uses: actions/checkout@v2
- name: Setup .NET Core
uses: actions/setup-dotnet@v3
with:
dotnet-version: |
8.0.x
7.0.x
6.0.x
- name: Restore
run: git submodule update --init --recursive
- name: Extract branch name
shell: bash
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
id: extract_branch
- name: Setup Version Suffix
shell: pwsh
run: |
$buildId = $env:GITHUB_RUN_NUMBER.PadLeft(5, '0');
$versionSuffixPR = "PR${{ github.event.pull_request.number }}-$buildId";
$branchName = "${{ steps.extract_branch.outputs.branch }}".Replace("_","").Replace("/","-");
$versionSuffixBRANCH = "$($branchName)-CI$($buildId)"
$env:VersionSuffix = if ("${{ github.event.pull_request.number }}") { $versionSuffixPR } else { $versionSuffixBRANCH }
Write-Output "##[set-output name=version_suffix]$($env:VersionSuffix)"
id: version_suffix
- name: Package
run: dotnet pack build.proj --version-suffix ${{ steps.version_suffix.outputs.version_suffix }}
- name: Upload Artifacts
uses: actions/upload-artifact@v2
with:
name: nupkg
path: ./bin/nupkg/*.nupkg
- name: Push to GitHub Feed
shell: bash
run: |
for f in ./bin/nupkg/*.nupkg
do
echo $f
dotnet nuget push $f -k ${{ secrets.GITHUB_TOKEN }} -s https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json
done
docs:
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
- name: Setup .NET Core
uses: actions/setup-dotnet@v3
with:
dotnet-version: |
8.0.x
7.0.x
6.0.x
5.0.x
- name: Restore
run: git submodule update --init --recursive
- name: Build All Docs
run: dotnet msbuild -target:AllDocs build.proj