Skip to content

Commit 4dbda8a

Browse files
authored
chore: update nuget build and deploy github action to support semantic versioning 2.0 (#580)
* build: re-enable GeneratePackageOnBuild for GithubAction * chore: update nuget build and deploy github action to support semantic versioning 2.0
1 parent eaf09f1 commit 4dbda8a

File tree

3 files changed

+17
-17
lines changed

3 files changed

+17
-17
lines changed

.github/workflows/release-nuget.yml

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,26 @@ jobs:
1515
- name: Setup .NET Core
1616
uses: actions/setup-dotnet@v3
1717
with:
18-
dotnet-version: 3.1.101
18+
dotnet-version: 3.1.x
1919

2020
- name: Install dependencies
2121
run: dotnet restore src/Appium.Net.sln
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: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
<Project Sdk="Microsoft.NET.Sdk">
1+
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFrameworks>netstandard2.0;net48;net45</TargetFrameworks>
4+
<TargetFrameworks>netstandard2.0;net48</TargetFrameworks>
55
<PackageLicenseFile>LICENSE.txt</PackageLicenseFile>
66
<RootNamespace>OpenQA.Selenium</RootNamespace>
77
<Company>Appium Commiters</Company>
88
<Product>Dotnet-Client</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/dotnet-client</PackageProjectUrl>
1313
<RepositoryUrl>https://github.com/appium/dotnet-client</RepositoryUrl>
1414
<RepositoryType>git</RepositoryType>
@@ -46,14 +46,6 @@
4646
<NoWarn>1701;1702;1591</NoWarn>
4747
</PropertyGroup>
4848

49-
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|net45|AnyCPU'">
50-
<NoWarn>1701;1702;1591</NoWarn>
51-
</PropertyGroup>
52-
53-
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Release|net45|AnyCPU'">
54-
<NoWarn>1701;1702;1591</NoWarn>
55-
</PropertyGroup>
56-
5749
<ItemGroup>
5850
<None Include="LICENSE.txt" Pack="true" PackagePath="" />
5951
</ItemGroup>

test/integration/Appium.Net.Integration.Tests.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
3-
<TargetFrameworks>net48;net45</TargetFrameworks>
3+
<TargetFrameworks>net48</TargetFrameworks>
44
</PropertyGroup>
55
<ItemGroup>
66
<Compile Remove="apps\**" />

0 commit comments

Comments
 (0)