Skip to content

Commit

Permalink
CI/GitHub: Cache OpenSSL installation
Browse files Browse the repository at this point in the history
  • Loading branch information
Shauren committed Jun 6, 2024
1 parent 41ef607 commit dc20f5a
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions .github/workflows/win-x64-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,23 +21,36 @@ jobs:
echo "OPENSSL_ROOT_DIR=C:/libs/openssl" >> $env:GITHUB_ENV
echo "MYSQL_ROOT_DIR=C:/Program Files/MySQL/MySQL Server 8.0" >> $env:GITHUB_ENV
- name: Download and install Openssl 3.x
- name: Get current OpenSSL version
id: openssl-info
run: |
$VersionsUrl = "https://api.github.com/repos/slproweb/opensslhashes/contents/win32_openssl_hashes.json"
$Headers = @{
Accept="application/vnd.github.raw+json"
Authorization="Bearer ${{ secrets.GITHUB_TOKEN }}"
}
$Url = (Invoke-RestMethod $VersionsUrl -Headers $Headers).files.PSObject.Properties |
$openSSL = (Invoke-RestMethod $VersionsUrl -Headers $Headers).files.PSObject.Properties |
Select-Object -ExpandProperty Value |
Where-Object { $_.arch -eq 'INTEL' } |
Where-Object { $_.bits -eq '64' } |
Where-Object { $_.light -eq $false } |
Where-Object { $_.installer -eq 'exe' } |
Sort-Object -Descending @{ Expression = { [version]$_.basever } } |
Select-Object -First 1 -ExpandProperty url
Select-Object -First 1
[System.String]::Format("cache-key=openssl-{0}-{1}-{2}", $openSSL.basever, $openSSL.arch, $openSSL.bits) >> $env:GITHUB_OUTPUT
[System.String]::Format("url={0}", $openSSL.url) >> $env:GITHUB_OUTPUT
- name: Cache OpenSSL
id: cache-openssl
uses: actions/cache@v4
with:
path: ${{ env.OPENSSL_ROOT_DIR }}
key: ${{ steps.openssl-info.outputs.cache-key }}

(New-Object System.Net.WebClient).DownloadFile($Url, "${{ env.TEMP }}\openssl.exe")
- name: Download and install Openssl 3.x
if: ${{ steps.cache-openssl.outputs.cache-hit != 'true' }}
run: |
(New-Object System.Net.WebClient).DownloadFile("${{ steps.openssl-info.outputs.url }}", "${{ env.TEMP }}\openssl.exe")
Start-Process -Wait -FilePath "${{ env.TEMP }}\openssl.exe" "/SILENT","/SP-","/SUPPRESSMSGBOXES",/DIR=${{ env.OPENSSL_ROOT_DIR }}
# Quick Openssl install test
Expand Down

0 comments on commit dc20f5a

Please sign in to comment.