-
Notifications
You must be signed in to change notification settings - Fork 0
74 lines (61 loc) · 2.58 KB
/
ci-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
name: Build Tests and Publish .NET Core
on:
push:
branches-ignore:
- '!hotfix/*'
- 'main'
jobs:
build:
runs-on: ubuntu-latest
env:
Solution_Name: ServiceBusLifeboat
Unit_Tests_Working_Directory: ./tests/ServiceBusLifeboat.UnitTests
App_Working_Directory: ./src/ServiceBusLifeboat.Cli
steps:
# Make code checkout
- name: Checkout
uses: actions/checkout@v2
# Create version from .git/GitVersion.yml
- name: Get version from GitVersion.yml
id: get_version
run: echo "::set-output name=version::$(cat .github/GitVersion.yml | yq -r .version)"
# Setup an especific dotnet version
- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: '6.0.x'
include-prerelease: true
# Restore all dependencies from solution
- name: Restore dependencies
run: dotnet restore
# Compile all projects using solution
- name: Run dotnet build
run: dotnet build
# Run unit tests from unit tests csproj
- name: Run dotnet tests
working-directory: ${{env.Unit_Tests_Working_Directory}}
run: dotnet test
# Publish to windows x64
- name: Run dotnet publish for Windows
working-directory: ${{env.App_Working_Directory}}
run: dotnet publish -c Release -o ${{env.DOTNET_ROOT}}/publish/windows -r win-x64 -p:PublishReadyToRun=true -p:PublishSingleFile=true -p:PublishTrimmed=true --self-contained true -p:IncludeNativeLibrariesForSelfExtract=true -p:Version=${{ steps.get_version.outputs.version }}
# Publish to linux x64
- name: Run dotnet publish for Linux
working-directory: ${{env.App_Working_Directory}}
run: dotnet publish -c Release -o ${{env.DOTNET_ROOT}}/publish/linux -r linux-x64 -p:PublishReadyToRun=true -p:PublishSingleFile=true -p:PublishTrimmed=true --self-contained true -p:IncludeNativeLibrariesForSelfExtract=true -p:Version=${{ steps.get_version.outputs.version }}
# Upload linux artfact
- name: Upload linux binary artifact
uses: actions/upload-artifact@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
name: ${{env.Solution_Name}}_linux
path: ${{env.DOTNET_ROOT}}/publish/linux/
# Upload windows artfact
- name: Upload windows binary artifact
uses: actions/upload-artifact@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
name: ${{env.Solution_Name}}_windows
path: ${{env.DOTNET_ROOT}}/publish/windows/