-
Notifications
You must be signed in to change notification settings - Fork 1
56 lines (51 loc) · 1.66 KB
/
test-deploy.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
name: Test and Deploy Library
env:
VERSION_NUMBER: 1.0.4
NUGET_KEY: ${{ secrets.NUGET_API_KEY }}
on:
push:
branches:
- master
- develop
- release/*
pull_request:
branches: [ develop ]
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup .NET Core
uses: actions/setup-dotnet@v3
with:
dotnet-version: 6.0.x
- name: Install dependencies
run: dotnet restore
- name: Run tests
run: dotnet test --logger "junit;LogFileName=results.xml"
- name: Publish Unit Test Results
uses: EnricoMi/publish-unit-test-result-action/composite@v2
if: ${{ github.actor != 'dependabot[bot]' }}
with:
files: "**/TestResults/*.xml"
publish:
runs-on: ubuntu-latest
needs: [test]
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
steps:
- uses: actions/checkout@v3
- name: Setup .NET Core
uses: actions/setup-dotnet@v3
with:
dotnet-version: 6.0.x
- name: Output Version Number
run: echo "Version-$VERSION_NUMBER.$GITHUB_RUN_NUMBER"
- name: Install dependencies
run: dotnet restore
- name: Build
run: dotnet build --configuration Release --no-restore
- name: Package
run: dotnet pack ./src/NHSNumberValidator/NHSNumberValidator.csproj -c Release /P:PackageVersion=$VERSION_NUMBER.$GITHUB_RUN_NUMBER
- name: Publish
run: nuget push ./src/NHSNumberValidator/bin/Release/NHSNumberValidator.$VERSION_NUMBER.$GITHUB_RUN_NUMBER.nupkg -ApiKey $NUGET_KEY -NonInteractive -Source https://www.nuget.org/api/v2/package