-
Notifications
You must be signed in to change notification settings - Fork 15
82 lines (65 loc) · 2.44 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
name: .NET Core Build and Deploy
on:
push:
branches: master
pull_request:
branches: master
env:
MAJOR_MINOR_VERSION: 7.1.
SOLUTION_FILE: Agoda.LoadBalancing.sln
jobs:
build:
name: Build Package
runs-on: windows-latest # using windows agent for net462 build.
steps:
- uses: actions/checkout@v3
- name: Setup .NET Core SDK
uses: actions/setup-dotnet@v2
with:
dotnet-version: '6.0.x'
- name: Restore
run: dotnet restore
- name: Build
run: dotnet build --configuration Release --no-restore -p:Version=${{ env.MAJOR_MINOR_VERSION }}${{ github.run_number }}
# Run the tests, ideally should stop here if a fail and also publish results as artifacts
- name: Test
run: dotnet test
- name: Benchmark
run: ./Agoda.Frameworks.LoadBalancing.Benchmark/bin/Release/net6.0/Agoda.Frameworks.LoadBalancing.Benchmark
- name: Publish Benchmark Results artifact
uses: actions/upload-artifact@master
with:
name: BenchmarkDotNet
path: BenchmarkDotNet.Artifacts
- name: Pack Release
if: github.ref == 'refs/heads/master'
run: dotnet pack ${{ env.SOLUTION_FILE }} --configuration Debug -o finalpackage -p:Version=${{ env.MAJOR_MINOR_VERSION }}${{ github.run_number }} -p:PackageVersion=${{ env.MAJOR_MINOR_VERSION }}${{ github.run_number }}
- name: Pack Preview
if: github.ref != 'refs/heads/master'
run: dotnet pack ${{ env.SOLUTION_FILE }} --configuration Debug -o finalpackage -p:Version=${{ env.MAJOR_MINOR_VERSION }}${{ github.run_number }} -p:PackageVersion=${{ env.MAJOR_MINOR_VERSION }}${{ github.run_number }}-preview
- name: Publish nuget artifact
uses: actions/upload-artifact@v3
with:
name: nupkg
path: finalpackage
deploy:
needs: build
name: Deploy Packages
runs-on: ubuntu-latest
steps:
- name: Download Package artifact
uses: actions/download-artifact@v3
with:
name: nupkg
path: ./nupkg
- name: Setup NuGet
uses: NuGet/setup-nuget@v1
with:
nuget-api-key: ${{ secrets.NUGET_API_KEY }}
nuget-version: latest
- name: Setup .NET Core SDK
uses: actions/setup-dotnet@v2
with:
dotnet-version: '6.0.x'
- name: Push to NuGet
run: dotnet nuget push nupkg/**/*.nupkg -k ${{ secrets.NUGET_API_KEY }} -s https://api.nuget.org/v3/index.json --skip-duplicate