-
Notifications
You must be signed in to change notification settings - Fork 19
91 lines (89 loc) · 2.84 KB
/
dotnetbuild.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
83
84
85
86
87
88
89
90
91
name: .NET Build
on:
workflow_dispatch:
push:
paths:
- './src/**'
pull_request:
branches: [ main ]
paths:
- './src/**'
env:
DOTNET_CLI_TELEMETRY_OPTOUT: "true"
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: "true"
DOTNET_NOLOGO: "true"
jobs:
build:
strategy:
matrix:
application: [ Aggregator, Metering.SharedResourceBroker ]
outputs:
tagVersion: ${{ steps.nbgv.outputs.SemVer2 }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup .NET
uses: actions/setup-dotnet@v2
with:
dotnet-version: '8.0'
- name: Setup Semantic version
id: nbgv
uses: dotnet/[email protected]
with:
setAllVars: true
- name: Restore dependencies
working-directory: ./src
run: dotnet restore
- name: Build and Test (on Linux), then build a Windows release
working-directory: ./src
run: |
dotnet build --no-restore
dotnet test --no-build --verbosity normal
- name: Build and Publish ${{ matrix.application }} for Windows ZIP deployment
working-directory: ./src
run: |
cd ${{ matrix.application }}
dotnet publish \
-r win-x64 \
--self-contained true \
--configuration Release \
--output publishFolder
cd publishFolder
zip -r ../zip-deploy-${{ matrix.application }}-win-x64.zip *
- name: Upload ${{ matrix.application }} build artifact
uses: actions/upload-artifact@v2
with:
path: src/${{ matrix.application }}/zip-deploy-${{ matrix.application }}-win-x64.zip
name: ${{ matrix.application }}.${{env.NBGV_SemVer2}}
release:
name: Release Build
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v3
- name: Display structure of downloaded files
run: |
find . -type f
echo '${{ toJSON(job) }}'
echo '${{ toJSON(steps) }}'
- name: Archive build
id: build_archive
run: |
archive_path=Aggregator.${{needs.build.outputs.tagVersion}}/zip-deploy-Aggregator-win-x64.zip
echo "zip_agg=$archive_path" >> $GITHUB_OUTPUT
archive_path=Metering.SharedResourceBroker.${{needs.build.outputs.tagVersion}}/zip-deploy-Metering.SharedResourceBroker-win-x64.zip
echo "zip_srb=$archive_path" >> $GITHUB_OUTPUT
echo "Created the file $GITHUB_OUTPUT with the following content: "
cat $GITHUB_OUTPUT
- name: Release
uses: softprops/action-gh-release@v1
with:
name: Release-${{needs.build.outputs.tagVersion}}
tag_name: ${{needs.build.outputs.tagVersion}}
fail_on_unmatched_files: true
generate_release_notes: true
files: |
${{ steps.build_archive.outputs.zip_agg }}
${{ steps.build_archive.outputs.zip_srb }}