2222 required : false
2323 default : false
2424 type : boolean
25+ driver_update_release :
26+ description : ' Release for driver update only (bumps patch version)'
27+ required : false
28+ default : false
29+ type : boolean
2530 skip_nuget_publish :
2631 description : ' Skip publishing to NuGet.org'
2732 required : false
@@ -45,94 +50,38 @@ jobs:
4550 runs-on : ubuntu-latest
4651 outputs :
4752 should_build : ${{ steps.compare.outputs.should_build }}
48- playwright_version : ${{ steps.playwright.outputs.version }}
49- playwright_major_minor : ${{ steps.playwright.outputs.major_minor }}
50- patchright_version : ${{ steps.patchright.outputs.version }}
51- driver_version : ${{ steps.driver.outputs.version }}
52- driver_needs_update : ${{ steps.driver.outputs.needs_update }}
53+ is_driver_update : ${{ steps.compare.outputs.is_driver_update }}
54+ playwright_version : ${{ steps.versions.outputs.playwright_version }}
55+ playwright_major_minor : ${{ steps.versions.outputs.playwright_major_minor }}
56+ patchright_version : ${{ steps.versions.outputs.patchright_version }}
57+ driver_version : ${{ steps.versions.outputs.driver_version }}
58+ driver_available : ${{ steps.versions.outputs.driver_available }}
5359
5460 steps :
55- - name : Get latest Playwright .NET version
56- id : playwright
57- run : |
58- echo "Fetching latest Playwright .NET release..."
59- RESPONSE=$(curl -s https://api.github.com/repos/microsoft/playwright-dotnet/releases/latest)
60- TAG=$(echo "$RESPONSE" | jq -r '.tag_name')
61- VERSION="${TAG#v}" # Remove 'v' prefix
62- MAJOR_MINOR=$(echo "$VERSION" | cut -d. -f1,2)
63-
64- echo "Latest Playwright .NET: $VERSION (major.minor: $MAJOR_MINOR)"
65- echo "version=$VERSION" >> $GITHUB_OUTPUT
66- echo "major_minor=$MAJOR_MINOR" >> $GITHUB_OUTPUT
67-
68- - name : Get latest Patchright .NET version
69- id : patchright
70- run : |
71- echo "Fetching latest Patchright .NET release..."
72- RESPONSE=$(curl -s https://api.github.com/repos/DevEnterpriseSoftware/patchright-dotnet/releases/latest)
73-
74- # Handle case where no releases exist yet
75- if echo "$RESPONSE" | jq -e '.message == "Not Found"' > /dev/null 2>&1; then
76- echo "No releases found for Patchright .NET"
77- VERSION="0.0.0"
78- else
79- TAG=$(echo "$RESPONSE" | jq -r '.tag_name // "v0.0.0"')
80- VERSION="${TAG#v}" # Remove 'v' prefix
81- fi
82-
83- echo "Latest Patchright .NET: $VERSION"
84- echo "version=$VERSION" >> $GITHUB_OUTPUT
61+ - name : Checkout repository
62+ uses : actions/checkout@v4
8563
86- - name : Get latest compatible Patchright driver version
87- id : driver
88- run : |
89- echo "Fetching all Patchright driver releases..."
90- PLAYWRIGHT_MAJOR_MINOR="${{ steps.playwright.outputs.major_minor }}"
91- echo "Looking for driver versions matching major.minor: $PLAYWRIGHT_MAJOR_MINOR"
92-
93- # Fetch all releases (up to 10)
94- RESPONSE=$(curl -s "https://api.github.com/repos/Kaliiiiiiiiii-Vinyzu/patchright/releases?per_page=10")
95-
96- # Extract all version tags, remove 'v' prefix, filter by major.minor, sort by version, get highest
97- MATCHING_VERSION=$(echo "$RESPONSE" | jq -r '.[].tag_name' | \
98- sed 's/^v//' | \
99- grep "^${PLAYWRIGHT_MAJOR_MINOR}\." | \
100- sort -V | \
101- tail -1)
102-
103- if [ -n "$MATCHING_VERSION" ] && [ "$MATCHING_VERSION" != "" ]; then
104- echo "Found compatible driver version: $MATCHING_VERSION"
105- echo "version=$MATCHING_VERSION" >> $GITHUB_OUTPUT
106- echo "needs_update=true" >> $GITHUB_OUTPUT
107-
108- # Show all matching versions for debugging
109- echo ""
110- echo "All matching versions for $PLAYWRIGHT_MAJOR_MINOR:"
111- echo "$RESPONSE" | jq -r '.[].tag_name' | sed 's/^v//' | grep "^${PLAYWRIGHT_MAJOR_MINOR}\." | sort -V
112- else
113- echo "No driver version found matching major.minor $PLAYWRIGHT_MAJOR_MINOR"
114- echo "Available driver versions:"
115- echo "$RESPONSE" | jq -r '.[].tag_name' | head -10
116- echo "Will use default driver version from Playwright"
117- echo "version=" >> $GITHUB_OUTPUT
118- echo "needs_update=false" >> $GITHUB_OUTPUT
119- fi
64+ - name : Get versions
65+ id : versions
66+ uses : ./.github/actions/get-versions
12067
12168 - name : Compare versions
12269 id : compare
12370 run : |
124- PLAYWRIGHT="${{ steps.playwright .outputs.version }}"
125- PATCHRIGHT="${{ steps.patchright .outputs.version }}"
126- DRIVER="${{ steps.driver .outputs.version }}"
127- DRIVER_AVAILABLE="${{ steps.driver .outputs.needs_update }}"
128- PLAYWRIGHT_MAJOR_MINOR="${{ steps.playwright .outputs.major_minor }}"
71+ PLAYWRIGHT="${{ steps.versions .outputs.playwright_version }}"
72+ PATCHRIGHT="${{ steps.versions .outputs.patchright_version }}"
73+ DRIVER="${{ steps.versions .outputs.driver_version }}"
74+ DRIVER_AVAILABLE="${{ steps.versions .outputs.driver_available }}"
75+ PLAYWRIGHT_MAJOR_MINOR="${{ steps.versions .outputs.playwright_major_minor }}"
12976 FORCE="${{ github.event.inputs.force_build }}"
77+ DRIVER_UPDATE="${{ github.event.inputs.driver_update_release }}"
13078
131- echo "Playwright .NET version : $PLAYWRIGHT"
132- echo "Patchright .NET version : $PATCHRIGHT"
133- echo "Patchright Driver version: $DRIVER"
134- echo "Driver available for $PLAYWRIGHT_MAJOR_MINOR: $DRIVER_AVAILABLE"
13579 echo "Force build: $FORCE"
80+ echo "Playwright .NET version : $PLAYWRIGHT"
81+ echo "Patchright .NET version : $PATCHRIGHT"
82+ echo "Patchright Driver version : $DRIVER"
83+ echo "Driver available for $PLAYWRIGHT_MAJOR_MINOR: $DRIVER_AVAILABLE"
84+ echo "Driver update release: $DRIVER_UPDATE"
13685
13786 # Function to compare semantic versions
13887 version_gt() {
@@ -141,7 +90,13 @@ jobs:
14190
14291 # Check if we need to build
14392 NEEDS_BUILD=false
144- if [ "$FORCE" = "true" ]; then
93+ IS_DRIVER_UPDATE=false
94+
95+ if [ "$DRIVER_UPDATE" = "true" ]; then
96+ echo "Driver update release requested - will bump patch version"
97+ NEEDS_BUILD=true
98+ IS_DRIVER_UPDATE=true
99+ elif [ "$FORCE" = "true" ]; then
145100 echo "Force build requested"
146101 NEEDS_BUILD=true
147102 elif version_gt "$PLAYWRIGHT" "$PATCHRIGHT"; then
@@ -151,6 +106,8 @@ jobs:
151106 echo "Patchright is up to date"
152107 fi
153108
109+ echo "is_driver_update=$IS_DRIVER_UPDATE" >> $GITHUB_OUTPUT
110+
154111 # If we need to build, verify driver is available
155112 if [ "$NEEDS_BUILD" = "true" ]; then
156113 if [ "$DRIVER_AVAILABLE" != "true" ]; then
@@ -193,10 +150,44 @@ jobs:
193150 uses : actions/setup-dotnet@v4
194151 with :
195152 dotnet-version : ${{ env.DOTNET_VERSION }}
153+
196154 - name : Run build script
197155 id : build
198156 run : .\build.ps1 -Cleanup -DriverVersion ${{ needs.check-versions.outputs.driver_version }}
199157
158+ - name : Bump patch version for driver update
159+ if : needs.check-versions.outputs.is_driver_update == 'true'
160+ run : |
161+ $versionPropsPath = "playwright-dotnet/src/Common/Version.props"
162+ [xml]$xml = Get-Content $versionPropsPath
163+
164+ # Get current version and bump patch
165+ $currentVersion = $xml.Project.PropertyGroup.AssemblyVersion
166+ $versionParts = $currentVersion -split '\.'
167+ $major = [int]$versionParts[0]
168+ $minor = [int]$versionParts[1]
169+ $patch = [int]$versionParts[2] + 1
170+ $newVersion = "$major.$minor.$patch"
171+
172+ Write-Host "Bumping version for driver update: $currentVersion -> $newVersion" -ForegroundColor Cyan
173+
174+ # Update all version elements
175+ $xml.Project.PropertyGroup.AssemblyVersion = $newVersion
176+ $xml.Save($versionPropsPath)
177+
178+ # Rebuild with new version
179+ Write-Host "Rebuilding with new version..." -ForegroundColor Cyan
180+ Push-Location playwright-dotnet
181+ try {
182+ dotnet build --configuration Release ./src/Playwright.sln
183+ dotnet pack --no-build --configuration Release --output ../nuget ./src/Playwright/Playwright.csproj
184+ }
185+ finally {
186+ Pop-Location
187+ }
188+
189+ Write-Host "✓ Version bumped and rebuilt" -ForegroundColor Green
190+
200191 - name : Get package version
201192 id : get_version
202193 run : |
@@ -260,45 +251,51 @@ jobs:
260251 uses : softprops/action-gh-release@v2
261252 with :
262253 tag_name : v${{ needs.build.outputs.package_version }}
263- name : Patchright .NET v${{ needs.build.outputs.package_version }}
254+ name : v${{ needs.build.outputs.package_version }}
264255 body : |
265256 ## Patchright .NET v${{ needs.build.outputs.package_version }}
266257
258+ ${{ github.event.inputs.skip_nuget_publish == 'true' && '> ⚠️ **NOT PUBLISHED TO NUGET** - This release has not been published to NuGet.org yet. The package is only available as a download from this release.' || format('[](https://www.nuget.org/packages/Patchright/{0})', needs.build.outputs.package_version) }}
259+
260+ ${{ needs.check-versions.outputs.is_driver_update == 'true' && '> **Driver Update Release** - This is a patch release to update the Patchright driver version.' || '' }}
261+
267262 This release is based on [Playwright .NET v${{ needs.check-versions.outputs.playwright_version }}](https://github.com/microsoft/playwright-dotnet/releases/tag/v${{ needs.check-versions.outputs.playwright_version }}).
268263
269- ${{ needs.check-versions.outputs.driver_needs_update == 'true' && format('Driver version: {0}', needs.check-versions.outputs.driver_version) || '' }}
264+ ${{ needs.check-versions.outputs.driver_available == 'true' && format('Driver version: {0}', needs.check-versions.outputs.driver_version) || '' }}
270265
271266 ### Installation
272267
273- ```bash
268+ ${{ github.event.inputs.skip_nuget_publish == 'true' && '> ⚠️ This version is not available on NuGet yet. Download the `.nupkg` file from this release to install manually.' || '' }}
269+
270+ ```sh
274271 dotnet add package Patchright --version ${{ needs.build.outputs.package_version }}
275272 ```
276273
277274 Or via NuGet Package Manager:
278- ```
275+ ```sh
279276 Install-Package Patchright -Version ${{ needs.build.outputs.package_version }}
280277 ```
281278
282279 ### What's Changed
283- - Updated to Playwright .NET v${{ needs.check-versions.outputs.playwright_version }}
284- ${{ needs.check-versions.outputs.driver_needs_update == 'true' && format('- Updated Patchright driver to v{0}', needs.check-versions.outputs.driver_version) || '' }}
285-
280+ ${{ needs.check-versions.outputs.is_driver_update == 'true' && format('- Driver update release for Playwright .NET v{0}', needs.check-versions.outputs.playwright_version) || format('- Updated to Playwright .NET v{0}', needs.check-versions.outputs.playwright_version) }}
281+ ${{ needs.check-versions.outputs.driver_available == 'true' && format('- Updated Patchright driver to v{0}', needs.check-versions.outputs.driver_version) || '' }}
282+
286283 ### Files
287284 - `${{ needs.build.outputs.package_name }}` - NuGet package
288285 - `patchright.patch` - Patch file applied to Playwright .NET
289286 files : |
290287 nuget/*.nupkg
291288 patchright.patch
292289 draft : false
293- prerelease : false
290+ prerelease : ${{ github.event.inputs.skip_nuget_publish == 'true' }}
294291 generate_release_notes : false
295292 env :
296293 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
297294
298295 # Job 4: Publish to NuGet.org
299296 publish-nuget :
300297 name : Publish to NuGet.org
301- needs : [build, release ]
298+ needs : [build]
302299 if : github.event.inputs.skip_nuget_publish != 'true'
303300 runs-on : ubuntu-latest
304301
@@ -326,8 +323,8 @@ jobs:
326323
327324 - name : Publish complete
328325 run : |
329- echo "✅ Package published to NuGet.org successfully!"
330- echo "View at: https://www.nuget.org/packages/Patchright/ "
326+ echo "✓ Package published to NuGet.org successfully!"
327+ echo "View at: https://www.nuget.org/packages/Patchright"
331328
332329 # Job 5: Notify on failure
333330 notify-failure :
0 commit comments