Remove branches #16
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 | |
on: | |
push: | |
pull_request: | |
jobs: | |
build: | |
runs-on: self-hosted | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v2 | |
with: | |
dotnet-version: 8.0.x | |
- name: Build | |
run: dotnet build Xunit.Runner.Http.sln -c Release | |
publish: | |
runs-on: self-hosted | |
needs: [Build] | |
steps: | |
- name: Publish Nuget Packages | |
run: | | |
$branchParts = "${{ github.ref }}".Split('/'); | |
$branch = $branchParts[$branchParts.Length - 1] | |
$prerelease = "" | |
if($branch -ne "main") { | |
$prerelease = $branch.Replace("/", "-") + ".${{ github.run_number }}" | |
} | |
Write-Host "Branch: $branch" | |
Write-Host "Pre-Release: $prerelease" | |
$output = "packages" | |
if($prerelease -ne "") { | |
Write-Host "Branch: Creating Prerelease $prerelease packages" | |
dotnet pack Xunit.Runner.Http/Xunit.Runner.Http.csproj -c Release --no-build --no-restore --version-suffix $prerelease -o $output | |
} else { | |
Write-Host "Branch: Creating Release packages" | |
dotnet pack Xunit.Runner.Http/Xunit.Runner.Http.csproj -c Release --no-build --no-restore -o $output | |
} | |
dotnet nuget push "**/$output/**" --api-key "${{ secrets.NUGET_API_KEY }}" --source https://api.nuget.org/v3/index.json --skip-duplicate |