-
Notifications
You must be signed in to change notification settings - Fork 0
34 lines (26 loc) · 1.15 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
name: .NET Build and Version
on: [push, pull_request]
jobs:
build:
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- name: Install .NET 8.0 SDK
run: |
$url = "https://download.visualstudio.microsoft.com/download/pr/2b2d6133-c4f9-46dd-9ab6-86443a7f5783/340054e2ac7de2bff9eea73ec9d4995a/dotnet-sdk-8.0.100-win-x64.zip"
$output = "dotnet-sdk-8.0.100-win-x64.zip"
Invoke-WebRequest -Uri $url -OutFile $output
Expand-Archive $output -DestinationPath $Env:ProgramFiles\dotnet -Force
$env:PATH = "$Env:ProgramFiles\dotnet;" + $env:PATH
[Environment]::SetEnvironmentVariable("PATH", $env:PATH, [EnvironmentVariableTarget]::Machine)
- name: Setup .NET
uses: actions/setup-dotnet@v2
with:
dotnet-version: ${{ secrets.DOTNET_VERSION }}
- name: Restore NuGet packages
run: dotnet restore ${{ secrets.DOTNET_SOLUTION }}
- name: Build with version
run: dotnet build ${{ secrets.DOTNET_SOLUTION }} /p:BuildNumber=${{ github.run_number }}
- name: Print Run Number
run: echo "Run number $env:GITHUB_RUN_NUMBER"
shell: pwsh