workflow: GitHubFlow/v1 #120
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: Build, Publish, Tag | |
on: | |
push: | |
branches: [ "master", "release/**", "features/**" ] | |
pull_request: | |
branches: [ "master", "develop" ] | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: windows-latest | |
env: | |
Solution_Name: PrimS.Telnet.sln | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Install .NET Core | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: | | |
6.0.x | |
8.0.x | |
- name: Setup MSBuild.exe | |
uses: microsoft/setup-msbuild@v2 | |
- name: Install nuget | |
run: Invoke-WebRequest https://dist.nuget.org/win-x86-commandline/latest/nuget.exe -OutFile Nuget.exe | |
- name: Nuget restore | |
run: Nuget.exe restore | |
- name: Build Debug | |
run: msbuild $env:Solution_Name /p:Configuration=Debug /p:Platform="Any CPU" | |
- name: Telnet.CiTests | |
uses: rusty-bender/vstest-action@main | |
with: | |
testAssembly: PrimS.Telnet.CiTests.dll | |
searchFolder: ./**/bin/Debug/**/ | |
runInParallel: true | |
# Can't apparently run both full fat and core test suites together.' | |
- name: Telnet.*.CiTests | |
uses: rusty-bender/vstest-action@main | |
with: | |
testAssembly: PrimS.Telnet.*.CiTests.dll | |
searchFolder: ./**/bin/Debug/**/ | |
runInParallel: true | |
- name: GitVersion | |
run: dotnet tool install --global GitVersion.Tool | |
- name: Run GitVersion | |
run: | | |
dotnet-gitversion /showConfig | |
$str = dotnet-gitversion /updateprojectfiles | out-string | |
$json = ConvertFrom-Json $str | |
$json | |
$semVer = $json.SemVer | |
$fullSemVer = $json.FullSemVer | |
$nuGetVersionV2 = $json.MajorMinorPatch | |
$buildMetaDataPadded = "$($json.MajorMinorPatch)$($json.PreReleaseTagWithDash)$($json.WeightedPreReleaseNumber)" | |
Write-Host $json | |
Write-Host "semVer:" $semVer | |
Write-Host "fullSemVer:" $fullSemVer | |
Write-Host "nuGetVersionV2:" $nuGetVersionV2 | |
Write-Host "Pre buildMetaDataPadded:" $buildMetaDataPadded | |
if (${buildMetaDataPadded} = "0000") { | |
${buildMetaDataPadded} = '' | |
} | |
Write-Host "Post buildMetaDataPadded:" $buildMetaDataPadded | |
Write-Host "NuGetVersionV2ext:${nuGetVersionV2}${buildMetaDataPadded}" | |
echo "FullSemVer=$fullSemVer" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append | |
echo "SemVer=$semVer" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append | |
echo "NuGetVersionV2=$nuGetVersionV2" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append | |
echo "NuGetVersionV2ext=${nuGetVersionV2}${buildMetaDataPadded}" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append | |