-
Notifications
You must be signed in to change notification settings - Fork 1
60 lines (52 loc) · 1.96 KB
/
dotnet-publish.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
name: .NET Publish (Ubuntu)
on:
#push:
# branches:
# branches-ignore:
#pull_request:
# branches:
# branches-ignore:
release:
branches: [ main ]
types: [ published ]
env:
# Disable the .NET logo in the console output.
DOTNET_NOLOGO: true
# Disable the .NET first time experience to skip caching NuGet packages and speed up the build.
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
# Disable sending .NET CLI telemetry to Microsoft.
DOTNET_CLI_TELEMETRY_OPTOUT: true
BUILD_ARTIFACT_PATH: ${{github.workspace}}/build-artifacts
jobs:
build:
runs-on: ubuntu-20.04
steps:
- name: Configure MongoDB (Ubuntu)
run: sudo systemctl start mongod
- name: Checkout
uses: actions/checkout@v2
# If you want to specify a particular version, use this. Otherwise, will use the Runner's installed version
- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: |
6.0.x
7.0.x
- name: Get Build Version
id: getversion
uses: ./.github/workflows/get-version
- name: Install dependencies
run: dotnet restore
- name: Build
run: dotnet build --configuration Release --no-restore /p:Version=${{ steps.getversion.outputs.build-version }}
- name: Test
run: dotnet test --logger trx --results-directory ${{env.BUILD_ARTIFACT_PATH}}/test-results
- name: Pack
run: dotnet pack -c Release --no-build --include-symbols /p:SymbolPackageFormat=snupkg /p:Version=${{ steps.getversion.outputs.build-version }} /p:PackageOutputPath=${{env.BUILD_ARTIFACT_PATH}}/packages
- name: Publish to GitHub Packages
run: dotnet nuget push ${{env.BUILD_ARTIFACT_PATH}}/packages/*.nupkg -s https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json -k ${{ secrets.GITHUB_TOKEN }} --skip-duplicate
- name: Publish artifacts
if: ${{ always() }}
uses: actions/upload-artifact@v2
with:
path: ${{env.BUILD_ARTIFACT_PATH}}