diff --git a/.gitea/workflows/release.yml b/.gitea/workflows/release.yml index d55b2de..f08550c 100644 --- a/.gitea/workflows/release.yml +++ b/.gitea/workflows/release.yml @@ -21,13 +21,11 @@ jobs: - name: ソースコードのチェックアウト uses: actions/checkout@v7 env: - GIT_CONFIG_COUNT: "3" + GIT_CONFIG_COUNT: "2" GIT_CONFIG_KEY_0: url.https://git.routersys.com/routersys/.insteadOf GIT_CONFIG_VALUE_0: https://github.com/routersys/ - GIT_CONFIG_KEY_1: url.https://github.com/routersys/ComputeSharp.insteadOf - GIT_CONFIG_VALUE_1: https://github.com/routersys/ComputeSharp - GIT_CONFIG_KEY_2: url.https://git.routersys.com/manju-summoner/YukkuriMovieMaker.Generator.insteadOf - GIT_CONFIG_VALUE_2: https://github.com/manju-summoner/YukkuriMovieMaker.Generator + GIT_CONFIG_KEY_1: url.https://git.routersys.com/manju-summoner/YukkuriMovieMaker.Generator.insteadOf + GIT_CONFIG_VALUE_1: https://github.com/manju-summoner/YukkuriMovieMaker.Generator with: ref: ${{ inputs.tag || github.ref_name }} submodules: recursive @@ -47,9 +45,26 @@ jobs: $asset = $release.assets | Where-Object { $_.name -like "*.zip" } | Select-Object -First 1 } Write-Host "ダウンロード対象: $($asset.name)" - Invoke-WebRequest -Uri $asset.browser_download_url -OutFile "ymm4.zip" - Expand-Archive -Path "ymm4.zip" -DestinationPath "ymm4_extracted" -Force - $ymm4Dir = (Get-ChildItem -Path "ymm4_extracted" -Recurse -Filter "YukkuriMovieMaker.dll" | + $cache = Join-Path 'C:\runner\cache\ymm4' $asset.name + $extracted = "$cache.extracted" + $lock = New-Object System.Threading.Mutex($false, 'Global\ci-ymm4-cache') + [void]$lock.WaitOne() + try { + if (-not (Test-Path "$extracted\.complete")) { + New-Item -ItemType Directory -Force -Path (Split-Path $cache) | Out-Null + Invoke-WebRequest -Uri $asset.browser_download_url -OutFile $cache + Remove-Item -Recurse -Force $extracted -ErrorAction SilentlyContinue + Expand-Archive -Path $cache -DestinationPath $extracted -Force + New-Item -ItemType File -Path "$extracted\.complete" | Out-Null + } + else { + Write-Host "保存済みの YMM4 を使います: $extracted" + } + } + finally { + $lock.ReleaseMutex() + } + $ymm4Dir = (Get-ChildItem -Path $extracted -Recurse -Filter "YukkuriMovieMaker.dll" | Select-Object -First 1).DirectoryName Write-Host "YMM4 DLL ディレクトリ: $ymm4Dir" echo "YMM4_DIR=$ymm4Dir\" >> $env:GITHUB_OUTPUT