Skip to content

Commit 0fca41e

Browse files
authored
chore: update nuget build and deploy github action to support semantic versioning 2.0 (#581)
1 parent 5601eb5 commit 0fca41e

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

.github/workflows/release-nuget.yml

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,19 @@ jobs:
2222

2323
- name: Build
2424
run: |
25-
if ("${{github.ref}}".trim() -notmatch '^refs/tags/v(\d+\.\d+\.\d+)$') {
26-
exit 1
25+
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-]+)*))?)$') {
26+
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
2727
}
28-
$version = $matches[1]
29-
dotnet build src/Appium.Net.sln --no-restore --configuration Release -p:Version=$version
28+
else {
29+
$versionPrefix = $matches[2]
30+
$dotnetBuildCmd = "dotnet build src/Appium.Net.sln --configuration Release -p:VersionPrefix=${versionPrefix}"
31+
if ($matches.Count -eq 7) {
32+
$versionSuffix = $matches[6]
33+
$dotnetBuildCmd += " --version-suffix ${versionSuffix}"
34+
}
35+
}
36+
Write-Host $dotnetBuildCmd
37+
Invoke-Expression $dotnetBuildCmd
3038
3139
- name: Deploy to nuget
3240
run: dotnet nuget push **/*.nupkg --api-key ${{ secrets.NUGET_DEPLOY_KEY }} --source https://api.nuget.org/v3/index.json

src/Appium.Net/Appium.Net.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<Product>Appium-Dotnet-Driver</Product>
99
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
1010
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
11-
<Copyright>Copyright © 2022</Copyright>
11+
<Copyright>Copyright © 2023</Copyright>
1212
<PackageProjectUrl>https://github.com/appium/appium-dotnet-driver</PackageProjectUrl>
1313
<RepositoryUrl>https://github.com/appium/appium-dotnet-driver</RepositoryUrl>
1414
<RepositoryType>git</RepositoryType>

0 commit comments

Comments
 (0)