-
Notifications
You must be signed in to change notification settings - Fork 3
65 lines (48 loc) · 1.75 KB
/
build-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
62
63
64
# 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 Build
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
jobs:
build:
name: Build and test on all supported platforms.
# https://docs.github.com/en/actions/using-jobs/using-a-matrix-for-your-jobs
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- name: Restore dependencies
run: dotnet restore
- name: Build
run: dotnet build --no-restore
- name: Test
run: dotnet test --no-build --verbosity normal
publish:
name: Publish CI/CD snapshot
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- name: Install EF Core Tools
# https://stackoverflow.com/questions/59234655/apply-ef-migrations-in-github-workflow
run: dotnet tool install --global dotnet-ef
- name: Run build script
# https://stackoverflow.com/questions/58061430/how-to-call-powershell-script-with-github-actions-workflow
# https://stackoverflow.com/questions/58886293/getting-current-branch-and-commit-hash-in-github-action
shell: pwsh
run: |
$VersionDate = Get-Date -Format "yyyyMMdd-HHmm"
$VersionHash = git rev-parse --short "$GITHUB_SHA";
& ./Resources/build-prod.ps1 -VersionSuffix "-ci-$VersionDate-$VersionHash"