Workflow file for this run
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 and deploy NuGet package | |
on: | |
release: | |
types: [published] | |
jobs: | |
build: | |
runs-on: windows-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup .NET Core | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: 5.0.x | |
- name: Install dependencies | |
run: dotnet restore Appium.Net.sln | |
- name: Build | |
run: | | |
if ("${{github.ref}}".trim() -notmatch '^refs\/tags\/v(((0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*))(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?)$') { | |
Write-Host "Failed to find a tag with a value compatible with Sementic Versioning.\nEnsure the Sementic Versioning regex above matches the tag created for the release!"; exit 1 | |
} | |
else { | |
$versionPrefix = $matches[2] | |
$dotnetBuildCmd = "dotnet build Appium.Net.sln --configuration Release -p:VersionPrefix=${versionPrefix}" | |
if ($matches.Count -eq 7) { | |
$versionSuffix = $matches[6] | |
$dotnetBuildCmd += " --version-suffix ${versionSuffix}" | |
} | |
} | |
Write-Host $dotnetBuildCmd | |
Invoke-Expression $dotnetBuildCmd | |
- name: Deploy to nuget | |
run: dotnet nuget push **/*.nupkg --api-key ${{ secrets.NUGET_DEPLOY_KEY }} --source https://api.nuget.org/v3/index.json |