forked from jcansdale/gpr
-
Notifications
You must be signed in to change notification settings - Fork 0
88 lines (73 loc) · 2.68 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
name: gpr
on: [push,repository_dispatch,workflow_dispatch]
env:
NBGV_VERSION: 3.1.91
DOTNET_CLI_TELEMETRY_OPTOUT: 1
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1
ACTIONS_ALLOW_UNSECURE_COMMANDS: true # for nbgv
GprToolCsprojPath: src/GprTool/GprTool.csproj
GprToolTestsCsprojPath: test/GprTool.Tests/GprTool.Tests.csproj
TestResultsDirectory: TestResults
PackageOutputPath: nupkgs
jobs:
build-and-test:
name: Build
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [windows-latest, ubuntu-latest, macos-latest]
fail-fast: false
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Setup dotnet using global.json
uses: actions/[email protected]
- uses: dotnet/[email protected]
with:
setAllVars: true
- name: Build
shell: bash
run: |
dotnet build $GprToolCsprojPath -c Release -p:GeneratePackageOnBuild=True
- name: Test
shell: bash
run: |
dotnet test $GprToolTestsCsprojPath -c Release --logger:nunit --verbosity normal -p:IsRunningTests=True --results-directory $TestResultsDirectory
- name: Self publish tool
if: github.repository == 'jcansdale/gpr' && matrix.os == 'ubuntu-latest'
shell: bash
run: |
dotnet run --project $GprToolCsprojPath -- push $PackageOutputPath -k ${{ secrets.GITHUB_TOKEN }}
- name: Upload nupkg
if: github.repository == 'jcansdale/gpr'
uses: actions/upload-artifact@v2
with:
name: nupkgs-${{ matrix.os }}
path: ${{ github.workspace }}/${{ env.PackageOutputPath }}/**/*
publish:
if: github.repository == 'jcansdale/gpr' && github.ref == 'refs/heads/master'
runs-on: ubuntu-latest
name: Publish nuget packages
needs: [build-and-test]
steps:
- name: Download nupkgs
uses: actions/download-artifact@v2
with:
name: nupkgs-ubuntu-latest
path: ${{ github.workspace }}/${{ env.PackageOutputPath }}
- name: Push nuget packages
if: github.ref == 'refs/heads/master'
shell: bash
run: dotnet nuget push $PackageOutputPath/*.nupkg --source nuget.org --api-key ${{ secrets.NUGET_TOKEN }}
- name: Create github release tag
if: success() && github.ref == 'refs/heads/master'
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ env.BUILD_VERSION }}
release_name: Release v${{ env.BUILD_VERSION }}
draft: true
prerelease: false