Update HP Driver Pack Catalog #264
This file contains hidden or 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: Update HP Driver Pack Catalog | |
| on: | |
| workflow_dispatch: | |
| schedule: | |
| - cron: '0 */4 * * *' | |
| permissions: | |
| contents: write | |
| jobs: | |
| update: | |
| runs-on: windows-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: main | |
| - name: Download and extract HP HPClientDriverPackCatalog | |
| shell: pwsh | |
| run: | | |
| $cabPath = "$env:TEMP\HPClientDriverPackCatalog.cab" | |
| $xmlPath = "$env:TEMP\HPClientDriverPackCatalog.xml" | |
| Write-Host "Downloading HP HPClientDriverPackCatalog.cab..." | |
| Invoke-WebRequest -Uri 'https://hpia.hpcloud.hp.com/downloads/driverpackcatalog/HPClientDriverPackCatalog.cab' -OutFile $cabPath -UseBasicParsing | |
| Write-Host "Downloaded: $((Get-Item $cabPath).Length) bytes" | |
| Write-Host "Extracting CAB..." | |
| & expand.exe $cabPath $xmlPath | |
| Write-Host "Extracted: $((Get-Item $xmlPath).Length) bytes" | |
| Copy-Item $xmlPath 'OSDCloud\core\driverpacks\hp.xml' -Force | |
| Write-Host "Replaced OSDCloud\core\driverpacks\hp.xml" | |
| $dateReleased = (Select-String -Path 'OSDCloud\core\driverpacks\hp.xml' -Pattern 'DateReleased="([^"]+)"' | | |
| Select-Object -First 1).Matches[0].Groups[1].Value | |
| Write-Host "HP catalog DateReleased: $dateReleased" | |
| - name: Commit if changed | |
| shell: pwsh | |
| run: | | |
| git config user.name 'github-actions[bot]' | |
| git config user.email 'github-actions[bot]@users.noreply.github.com' | |
| git add OSDCloud/core/driverpacks/hp.xml | |
| if (git diff --cached --quiet) { | |
| Write-Host "No changes to commit." | |
| } else { | |
| $dateReleased = (Select-String -Path 'OSDCloud\core\driverpacks\hp.xml' -Pattern 'DateReleased="([^"]+)"' | | |
| Select-Object -First 1).Matches[0].Groups[1].Value | |
| git commit -m "chore(catalog): update HP driver pack catalog ($dateReleased)" | |
| git push | |
| } |