-
Notifications
You must be signed in to change notification settings - Fork 1
61 lines (47 loc) · 1.78 KB
/
dotnet.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
# This workflow will build a .NET project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net
name: .NET
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
create:
branches:
- release/**
jobs:
build:
env:
BUILD_CONFIG: 'Release'
SOLUTION: 'MavSdk.Net.sln'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: true
- name: Get Build Version
run: |
Import-Module ./build/GetBuildVersion.psm1
Write-Host $Env:GITHUB_REF
$version = GetBuildVersion -VersionString $Env:GITHUB_REF
echo "BUILD_VERSION=$version" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append
shell: pwsh
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 6.0.x
- name: Restore dependencies
run: dotnet restore $SOLUTION
- name: Build
run: dotnet build $SOLUTION --configuration Release --no-restore -p:Version=$BUILD_VERSION
- name: Test
run: dotnet test $SOLUTION --no-build --verbosity normal
- name: Prep packages
if: startsWith(github.ref, 'refs/tags/v')
run: dotnet nuget add source --username tank104 --password ${{ secrets.GITHUB_TOKEN }} --store-password-in-clear-text --name github "https://nuget.pkg.github.com/tank104/index.json"
- name: Publish to GitHub packages
if: startsWith(github.ref, 'refs/tags/v')
run: dotnet nuget push **/*.nupkg --api-key ${{ secrets.GITHUB_TOKEN }} --source "github"
- name: Publish to nuget.org
if: startsWith(github.ref, 'refs/tags/v')
run: dotnet nuget push **/*.nupkg --api-key ${{secrets.NUGET_API_KEY}} --source "https://api.nuget.org/v3/index.json"