Files
cutdex/tool/gitea/prepare-build-cache.ps1
T

15 lines
833 B
PowerShell

$ErrorActionPreference = 'Stop'
# Use runner-user caches rather than checkout-local directories. Preserve any
# administrator overrides, and do not archive caches while another job uses them.
$pubCache = if ($env:PUB_CACHE) { $env:PUB_CACHE } else { Join-Path $env:LOCALAPPDATA 'Pub/Cache' }
$gradleCache = if ($env:GRADLE_USER_HOME) { $env:GRADLE_USER_HOME } else { Join-Path $env:USERPROFILE '.gradle' }
foreach ($directory in @($pubCache, $gradleCache)) {
[IO.Directory]::CreateDirectory($directory) | Out-Null
}
if ($env:GITHUB_ENV) {
"PUB_CACHE=$pubCache" | Out-File -LiteralPath $env:GITHUB_ENV -Encoding utf8 -Append
"GRADLE_USER_HOME=$gradleCache" | Out-File -LiteralPath $env:GITHUB_ENV -Encoding utf8 -Append
}
Write-Output "Persistent Pub cache: $pubCache"
Write-Output "Persistent Gradle cache: $gradleCache"