-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
151 additions
and
24 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
name: .NET (Release) | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
releaseType: | ||
description: 'Release type - major, minor or patch' | ||
required: true | ||
default: 'minor' | ||
|
||
defaults: | ||
run: | ||
working-directory: visual-dotnet | ||
|
||
jobs: | ||
checks: | ||
runs-on: windows-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-dotnet@v4 | ||
with: | ||
dotnet-version: 6.0.x | ||
- run: dotnet tool install -g dotnet-format | ||
- run: dotnet format '.' --verify-no-changes | ||
- run: dotnet restore | ||
- run: dotnet build .\SauceLabs.Visual\SauceLabs.Visual.csproj --no-restore | ||
- run: dotnet test --verbosity normal | ||
|
||
release: | ||
runs-on: windows-latest | ||
needs: | ||
- checks | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-dotnet@v4 | ||
with: | ||
dotnet-version: 6.0.x | ||
|
||
- name: Setup Git | ||
if: ${{ steps.prep.outputs.tag_name == '' }} | ||
run: | | ||
git config --global user.name "sauce-visual-bot" | ||
git config --global user.email "[email protected]" | ||
- name: upgrade & push version | ||
id: upgrade | ||
run: | | ||
$newVersion = .\scripts\UpdateVersion.ps1 -project .\SauceLabs.Visual\SauceLabs.Visual.csproj -releaseType ${{ github.event.inputs.releaseType }} | ||
git add ./SauceLabs.Visual/SauceLabs.Visual.csproj | ||
git commit -m "[release] dotnet-$newVersion" | ||
git tag "dotnet-$newVersion" | ||
git push | ||
git push origin "dotnet-$newVersion" | ||
"tag_name=dotnet-$newVersion" | Out-File -Append $Env:GITHUB_OUTPUT | ||
"version=$newVersion" | Out-File -Append $Env:GITHUB_OUTPUT | ||
- name: build artifact | ||
run: dotnet build .\SauceLabs.Visual\SauceLabs.Visual.csproj -c Release | ||
|
||
- name: pack artifact | ||
run: dotnet pack .\SauceLabs.Visual\SauceLabs.Visual.csproj -c Release | ||
|
||
- name: publish artifact | ||
run: | | ||
$version = "${{ steps.upgrade.outputs.version }}" | ||
$apiKey = "${{ secrets.NUGET_API_KEY }}" | ||
dotnet nuget push .\SauceLabs.Visual\bin\Release\SauceLabs.Visual.$version.nupkg --api-key $apiKey --source https://api.nuget.org/v3/index.json | ||
- name: Github Release | ||
uses: softprops/action-gh-release@v2 | ||
with: | ||
fail_on_unmatched_files: true | ||
tag_name: ${{ steps.upgrade.outputs.tag_name }} | ||
files: visual-dotnet/SauceLabs.Visual/bin/Release/SauceLabs.Visual.${{ steps.upgrade.outputs.version }}.nupkg | ||
generate_release_notes: true |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,4 +4,4 @@ This repository contains the SDKs for Sauce Labs Visual. | |
|
||
## SDKs | ||
|
||
- [C#][./visual-dotnet] | ||
- [C#](./visual-dotnet) |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,40 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>netstandard2.0</TargetFramework> | ||
<RootNamespace>SauceLabs.Visual</RootNamespace> | ||
<GeneratePackageOnBuild>true</GeneratePackageOnBuild> | ||
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance> | ||
<PackageLicenseUrl>https://github.com/saucelabs/visual-csharp-client/blob/main/LICENSE</PackageLicenseUrl> | ||
<PackageLicenseExpression>Apache-2.0</PackageLicenseExpression> | ||
<language>en-US</language> | ||
<NeutralLanguage>en</NeutralLanguage> | ||
|
||
<PackageId>SauceLabs.Visual.Client</PackageId> | ||
<Version>0.0.1</Version> | ||
<PackageId>SauceLabs.Visual</PackageId> | ||
<Version>0.0.0</Version> | ||
<Title>Sauce Labs Visual Binding</Title> | ||
<PackageTags>saucelabs sauce labs visual testing screenshot capture dom</PackageTags> | ||
<RepositoryUrl>https://github.com/saucelabs/visual-csharp-client</RepositoryUrl> | ||
<RepositoryUrl>https://github.com/saucelabs/visual-sdks</RepositoryUrl> | ||
<RepositoryType>git</RepositoryType> | ||
<PackageProjectUrl>https://github.com/saucelabs/visual-sdks/tree/main/visual-dotnet</PackageProjectUrl> | ||
<PackageReadmeFile>README.md</PackageReadmeFile> | ||
<PackageIcon>icon.png</PackageIcon> | ||
<PackageLanguage>en-US</PackageLanguage> | ||
<Copyright>Sauce Labs</Copyright> | ||
<Authors>Sauce Labs</Authors> | ||
<Owners>Sauce Labs</Owners> | ||
<Company>Sauce Labs</Company> | ||
<Description>Sauce Labs Visual's integration with C# allows customers to run Visual Testing while running their Selenium sessions.</Description> | ||
<Description>Sauce Labs Visual's integration allows customers to run Visual Testing while running their Selenium sessions.</Description> | ||
<LangVersion>8</LangVersion> | ||
<Nullable>enable</Nullable> | ||
</PropertyGroup> | ||
|
||
<PropertyGroup Condition="'$(GITHUB_ACTIONS)' == 'true'"> | ||
<ContinuousIntegrationBuild>true</ContinuousIntegrationBuild> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="AnyRetry" Version="1.0.31" /> | ||
<PackageReference Include="GraphQL.Client" Version="6.0.2" /> | ||
<PackageReference Include="GraphQL.Client.Abstractions" Version="6.0.2" /> | ||
<PackageReference Include="GraphQL.Client.Serializer.Newtonsoft" Version="6.0.2" /> | ||
<PackageReference Include="GraphQL.Primitives" Version="6.0.2" /> | ||
<PackageReference Include="Selenium.WebDriver" Version="4.0.0" /> | ||
<None Include="..\README.md" Pack="true" PackagePath="\" /> | ||
<None Include="images\icon.png" Pack="true" PackagePath="" /> | ||
</ItemGroup> | ||
|
||
</Project> | ||
</Project> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
param ( | ||
[Parameter(Mandatory=$true)][string]$projectFile, | ||
[Parameter(Mandatory=$true)][string]$releaseType | ||
) | ||
|
||
function Update-Version { | ||
param ( | ||
[string]$version, | ||
[string]$releaseType | ||
) | ||
[Int32[]]$subVersion = $version.Split('.') | ||
|
||
if ($releaseType.Equals("major")) { | ||
$subVersion[0] = $subVersion[0] + 1 | ||
$subVersion[1] = 0 | ||
$subVersion[2] = 0 | ||
} | ||
|
||
if ($releaseType.Equals("minor")) { | ||
$subVersion[1] = $subVersion[1] + 1 | ||
$subVersion[2] = 0 | ||
} | ||
|
||
if ($releaseType.Equals("patch")) { | ||
$subVersion[2] = $subVersion[2] + 1 | ||
} | ||
return $subVersion -join "." | ||
}; | ||
|
||
|
||
$possibleReleaseType = "major","minor","patch" | ||
if (!$possibleReleaseType.Contains($releaseType)) { | ||
throw "$releaseType is not a valid upgrade" | ||
} | ||
|
||
if (!$projectFile.EndsWith(".csproj")) { | ||
throw "$projectFile is not a valid C# project" | ||
} | ||
|
||
[xml]$projectContent = Get-Content $projectFile | ||
|
||
$versionElement = $projectContent.SelectSingleNode("//Project/PropertyGroup/Version") | ||
|
||
[string]$version = $versionElement.InnerText | ||
[string]$newVersion = Update-Version -version $version -releaseType $releaseType | ||
|
||
$versionElement.InnerText = $newVersion | ||
$projectContent.Save($projectFile) | ||
Write-Output $newVersion |