set up GitHub #2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: .NET Build and Version | |
on: | |
push: | |
pull_request: | |
workflow_dispatch: | |
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: Add GitHub Packages source | |
run: | | |
nuget sources Add -Name "GitHub" -Source "https://nuget.pkg.github.com/PrimeEagle/index.json" -Username PrimeEagle -Password ${{ secrets.NUGET_TOKEN }} | |
- name: Restore NuGet packages | |
run: dotnet restore ${{ secrets.DOTNET_SOLUTION }} | |
env: | |
NUGET_AUTH_TOKEN: ${{ secrets.NUGET_TOKEN }} | |
- 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 |