diff --git a/.gitea/workflows/release-18efeafc.yml b/.gitea/workflows/release-18efeafc.yml deleted file mode 100644 index 9963255..0000000 --- a/.gitea/workflows/release-18efeafc.yml +++ /dev/null @@ -1,188 +0,0 @@ -name: リリース - -on: - push: - tags: - - 'v*' - workflow_dispatch: - inputs: - tag: - description: リリースするタグ - required: true - -permissions: - contents: write - -jobs: - build-and-release: - runs-on: windows-latest - - steps: - - name: ソースコードのチェックアウト - uses: actions/checkout@v4 - env: - 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://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 - - - name: YMM4 最新リリースの取得と解凍 - id: ymm4 - shell: pwsh - run: | - $latest = 'C:\runner\cache\ymm4\latest.json' - New-Item -ItemType Directory -Force -Path (Split-Path $latest) | Out-Null - if (-not (Test-Path $latest) -or ((Get-Date) - (Get-Item $latest).LastWriteTime).TotalHours -gt 6) { - try { - Invoke-RestMethod -Uri "https://api.github.com/repos/manju-summoner/YukkuriMovieMaker4/releases/latest" `, - -Headers @{ "User-Agent" = "LuaScript-CI" } -ErrorAction Stop | ConvertTo-Json -Depth 20 | Set-Content -Path $latest -Encoding UTF8 - } - catch { - if (-not (Test-Path $latest)) { throw } - Write-Host "最新版の問い合わせに失敗したため、保存済みの情報を使います: $($_.Exception.Message)" - } - } - $release = Get-Content -Raw -Path $latest | ConvertFrom-Json - $asset = $release.assets | Where-Object { $_.name -like "*_Lite.zip" } | Select-Object -First 1 - if (-not $asset) { - $asset = $release.assets | Where-Object { $_.name -like "*.zip" } | Select-Object -First 1 - } - Write-Host "ダウンロード対象: $($asset.name)" - $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 - - - name: タグ名からバージョンを取得 - id: version - shell: pwsh - run: | - $tag = "${{ inputs.tag || github.ref_name }}" - echo "TAG=$tag" >> $env:GITHUB_OUTPUT - echo "VERSION=$($tag.TrimStart('v'))" >> $env:GITHUB_OUTPUT - - - name: プロジェクトのビルド - shell: pwsh - env: - CI: 'true' - run: | - dotnet build LuaScript/LuaScript.csproj ` - -c Release ` - -p:YMM4DirPath="${{ steps.ymm4.outputs.YMM4_DIR }}" ` - -p:Platform=x64 - - - name: パッケージの作成 - id: package - shell: pwsh - run: | - $version = "${{ steps.version.outputs.TAG }}" - $outDir = "LuaScript/bin/x64/Release/net10.0-windows10.0.19041.0" - $stageRoot = "stage/LuaScript" - $pkgName = "LuaScript_$version.ymme" - - New-Item -ItemType Directory -Path "$stageRoot/docs" -Force | Out-Null - New-Item -ItemType Directory -Path "$stageRoot/native" -Force | Out-Null - New-Item -ItemType Directory -Path "$stageRoot/LICENSE" -Force | Out-Null - - Copy-Item "$outDir/LuaScript.dll" "$stageRoot/" - Copy-Item "$outDir/MoonSharp.Interpreter.dll" "$stageRoot/" - Copy-Item "$outDir/native/luajit.exe" "$stageRoot/native/" - Copy-Item "$outDir/native/lua51.dll" "$stageRoot/native/" - Copy-Item "$outDir/native/worker.lua" "$stageRoot/native/" - Copy-Item "$outDir/native/shim.lua" "$stageRoot/native/" - - foreach ($lang in @("ar-sa", "en-us", "es-es", "id-id", "ko-kr", "zh-cn", "zh-tw")) { - $src = "$outDir/$lang" - if (Test-Path $src) { - New-Item -ItemType Directory -Path "$stageRoot/$lang" -Force | Out-Null - Copy-Item "$src/*.dll" "$stageRoot/$lang/" - } - } - - Copy-Item "LuaScript/docs/LuaScript.*.txt" "$stageRoot/docs/" - Copy-Item ".github/LICENSE/*.txt" "$stageRoot/LICENSE/" - Copy-Item ".github/Plugin_Readme.txt" "$stageRoot/Readme.txt" - - Compress-Archive -Path "stage/*" -DestinationPath $pkgName -CompressionLevel Optimal - echo "PKG_NAME=$pkgName" >> $env:GITHUB_OUTPUT - - - name: Gitea リリースの作成 - shell: pwsh - env: - GITEA_TOKEN: ${{ github.token }} - REPOSITORY: ${{ github.repository }} - SERVER_URL: ${{ github.server_url }} - RELEASE_TAG: ${{ inputs.tag || github.ref_name }} - RELEASE_NAME: ${{ steps.version.outputs.TAG }} - RELEASE_BODY: '' - RELEASE_BODY_PATH: .github/CHANGELOG.md - RELEASE_DRAFT: false - RELEASE_PRERELEASE: false - RELEASE_FILES: | - ${{ steps.package.outputs.PKG_NAME }} - run: | - $headers = @{ Authorization = "token $env:GITEA_TOKEN" } - $api = "$env:SERVER_URL/api/v1/repos/$env:REPOSITORY" - $tag = $env:RELEASE_TAG - - $body = $env:RELEASE_BODY - if ($env:RELEASE_BODY_PATH -and (Test-Path $env:RELEASE_BODY_PATH)) { - $body = Get-Content $env:RELEASE_BODY_PATH -Raw -Encoding utf8 - } - - $files = @() - foreach ($pattern in ($env:RELEASE_FILES -split "[`r`n,]+" | Where-Object { $_.Trim() })) { - $found = @(Get-ChildItem -Path $pattern.Trim() -File -ErrorAction SilentlyContinue) - if ($found.Count -eq 0) { throw "リリースに付けるファイルが見つかりません: $pattern" } - $files += $found - } - - $payload = @{ - tag_name = $tag - name = $env:RELEASE_NAME - body = [string]$body - draft = ($env:RELEASE_DRAFT -eq 'true') - prerelease = ($env:RELEASE_PRERELEASE -eq 'true') - } | ConvertTo-Json - $bytes = [System.Text.Encoding]::UTF8.GetBytes($payload) - - $existing = $null - try { $existing = Invoke-RestMethod -Uri "$api/releases/tags/$([System.Uri]::EscapeDataString($tag))" -Headers $headers } catch { } - if ($existing) { - $release = Invoke-RestMethod -Method Patch -Uri "$api/releases/$($existing.id)" -Headers $headers -ContentType "application/json; charset=utf-8" -Body $bytes - foreach ($asset in @($existing.assets)) { - Invoke-RestMethod -Method Delete -Uri "$api/releases/$($existing.id)/assets/$($asset.id)" -Headers $headers | Out-Null - } - } else { - $release = Invoke-RestMethod -Method Post -Uri "$api/releases" -Headers $headers -ContentType "application/json; charset=utf-8" -Body $bytes - } - foreach ($file in $files) { - $name = [System.Uri]::EscapeDataString($file.Name) - Invoke-RestMethod -Method Post -Uri "$api/releases/$($release.id)/assets?name=$name" -Headers $headers -Form @{ attachment = Get-Item $file.FullName } | Out-Null - Write-Host "添付しました: $($file.Name)" - } - Write-Host "リリースを作成しました: $($release.html_url)" - diff --git a/.gitea/workflows/release-299ddcfe.yml b/.gitea/workflows/release-299ddcfe.yml deleted file mode 100644 index f63a7e7..0000000 --- a/.gitea/workflows/release-299ddcfe.yml +++ /dev/null @@ -1,192 +0,0 @@ -name: リリース - -on: - push: - tags: - - 'v*' - workflow_dispatch: - inputs: - tag: - description: リリースするタグ - required: true - -permissions: - contents: write - -jobs: - build-and-release: - runs-on: windows-latest - - steps: - - name: ソースコードのチェックアウト - uses: actions/checkout@v4 - env: - 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://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 - - - name: YMM4 最新リリースの取得と解凍 - id: ymm4 - shell: pwsh - run: | - $latest = 'C:\runner\cache\ymm4\latest.json' - New-Item -ItemType Directory -Force -Path (Split-Path $latest) | Out-Null - if (-not (Test-Path $latest) -or ((Get-Date) - (Get-Item $latest).LastWriteTime).TotalHours -gt 6) { - try { - Invoke-RestMethod -Uri "https://api.github.com/repos/manju-summoner/YukkuriMovieMaker4/releases/latest" `, - -Headers @{ "User-Agent" = "LuaScript-CI" } -ErrorAction Stop | ConvertTo-Json -Depth 20 | Set-Content -Path $latest -Encoding UTF8 - } - catch { - if (-not (Test-Path $latest)) { throw } - Write-Host "最新版の問い合わせに失敗したため、保存済みの情報を使います: $($_.Exception.Message)" - } - } - $release = Get-Content -Raw -Path $latest | ConvertFrom-Json - $asset = $release.assets | Where-Object { $_.name -like "*_Lite.zip" } | Select-Object -First 1 - if (-not $asset) { - $asset = $release.assets | Where-Object { $_.name -like "*.zip" } | Select-Object -First 1 - } - Write-Host "ダウンロード対象: $($asset.name)" - $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 - - - name: タグ名からバージョンを取得 - id: version - shell: pwsh - run: | - $tag = "${{ inputs.tag || github.ref_name }}" - echo "TAG=$tag" >> $env:GITHUB_OUTPUT - echo "VERSION=$($tag.TrimStart('v'))" >> $env:GITHUB_OUTPUT - - - name: プロジェクトのビルド - shell: pwsh - env: - CI: 'true' - run: | - dotnet build LuaScript/LuaScript.csproj ` - -c Release ` - -p:YMM4DirPath="${{ steps.ymm4.outputs.YMM4_DIR }}" ` - -p:Platform=x64 - - - name: パッケージの作成 - id: package - shell: pwsh - run: | - $version = "${{ steps.version.outputs.TAG }}" - $outDir = "LuaScript/bin/x64/Release/net10.0-windows10.0.19041.0" - $stageRoot = "stage/LuaScript" - $pkgName = "LuaScript_$version.ymme" - - New-Item -ItemType Directory -Path "$stageRoot/docs" -Force | Out-Null - New-Item -ItemType Directory -Path "$stageRoot/native" -Force | Out-Null - New-Item -ItemType Directory -Path "$stageRoot/LICENSE" -Force | Out-Null - - Copy-Item "$outDir/LuaScript.dll" "$stageRoot/" - Copy-Item "$outDir/LuaScript.Kernel.dll" "$stageRoot/" - Copy-Item "$outDir/LuaScript.Compat.dll" "$stageRoot/" - Copy-Item "$outDir/LuaScript.Media.dll" "$stageRoot/" - Copy-Item "$outDir/LuaScript.Runtime.dll" "$stageRoot/" - Copy-Item "$outDir/MoonSharp.Interpreter.dll" "$stageRoot/" - Copy-Item "$outDir/native/luajit.exe" "$stageRoot/native/" - Copy-Item "$outDir/native/lua51.dll" "$stageRoot/native/" - Copy-Item "$outDir/native/worker.lua" "$stageRoot/native/" - Copy-Item "$outDir/native/shim.lua" "$stageRoot/native/" - - foreach ($lang in @("ar-sa", "en-us", "es-es", "id-id", "ko-kr", "zh-cn", "zh-tw")) { - $src = "$outDir/$lang" - if (Test-Path $src) { - New-Item -ItemType Directory -Path "$stageRoot/$lang" -Force | Out-Null - Copy-Item "$src/*.dll" "$stageRoot/$lang/" - } - } - - Copy-Item "LuaScript/docs/LuaScript.*.txt" "$stageRoot/docs/" - Copy-Item ".github/LICENSE/*.txt" "$stageRoot/LICENSE/" - Copy-Item ".github/Plugin_Readme.txt" "$stageRoot/Readme.txt" - - Compress-Archive -Path "stage/*" -DestinationPath $pkgName -CompressionLevel Optimal - echo "PKG_NAME=$pkgName" >> $env:GITHUB_OUTPUT - - - name: Gitea リリースの作成 - shell: pwsh - env: - GITEA_TOKEN: ${{ github.token }} - REPOSITORY: ${{ github.repository }} - SERVER_URL: ${{ github.server_url }} - RELEASE_TAG: ${{ inputs.tag || github.ref_name }} - RELEASE_NAME: ${{ steps.version.outputs.TAG }} - RELEASE_BODY: '' - RELEASE_BODY_PATH: .github/CHANGELOG.md - RELEASE_DRAFT: false - RELEASE_PRERELEASE: false - RELEASE_FILES: | - ${{ steps.package.outputs.PKG_NAME }} - run: | - $headers = @{ Authorization = "token $env:GITEA_TOKEN" } - $api = "$env:SERVER_URL/api/v1/repos/$env:REPOSITORY" - $tag = $env:RELEASE_TAG - - $body = $env:RELEASE_BODY - if ($env:RELEASE_BODY_PATH -and (Test-Path $env:RELEASE_BODY_PATH)) { - $body = Get-Content $env:RELEASE_BODY_PATH -Raw -Encoding utf8 - } - - $files = @() - foreach ($pattern in ($env:RELEASE_FILES -split "[`r`n,]+" | Where-Object { $_.Trim() })) { - $found = @(Get-ChildItem -Path $pattern.Trim() -File -ErrorAction SilentlyContinue) - if ($found.Count -eq 0) { throw "リリースに付けるファイルが見つかりません: $pattern" } - $files += $found - } - - $payload = @{ - tag_name = $tag - name = $env:RELEASE_NAME - body = [string]$body - draft = ($env:RELEASE_DRAFT -eq 'true') - prerelease = ($env:RELEASE_PRERELEASE -eq 'true') - } | ConvertTo-Json - $bytes = [System.Text.Encoding]::UTF8.GetBytes($payload) - - $existing = $null - try { $existing = Invoke-RestMethod -Uri "$api/releases/tags/$([System.Uri]::EscapeDataString($tag))" -Headers $headers } catch { } - if ($existing) { - $release = Invoke-RestMethod -Method Patch -Uri "$api/releases/$($existing.id)" -Headers $headers -ContentType "application/json; charset=utf-8" -Body $bytes - foreach ($asset in @($existing.assets)) { - Invoke-RestMethod -Method Delete -Uri "$api/releases/$($existing.id)/assets/$($asset.id)" -Headers $headers | Out-Null - } - } else { - $release = Invoke-RestMethod -Method Post -Uri "$api/releases" -Headers $headers -ContentType "application/json; charset=utf-8" -Body $bytes - } - foreach ($file in $files) { - $name = [System.Uri]::EscapeDataString($file.Name) - Invoke-RestMethod -Method Post -Uri "$api/releases/$($release.id)/assets?name=$name" -Headers $headers -Form @{ attachment = Get-Item $file.FullName } | Out-Null - Write-Host "添付しました: $($file.Name)" - } - Write-Host "リリースを作成しました: $($release.html_url)" - diff --git a/.gitea/workflows/release-2bf339b9.yml b/.gitea/workflows/release-2bf339b9.yml deleted file mode 100644 index eaeb38f..0000000 --- a/.gitea/workflows/release-2bf339b9.yml +++ /dev/null @@ -1,186 +0,0 @@ -name: リリース - -on: - push: - tags: - - 'v*' - workflow_dispatch: - inputs: - tag: - description: リリースするタグ - required: true - -permissions: - contents: write - -jobs: - build-and-release: - runs-on: windows-latest - - steps: - - name: ソースコードのチェックアウト - uses: actions/checkout@v4 - env: - 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://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 - - - name: YMM4 最新リリースの取得と解凍 - id: ymm4 - shell: pwsh - run: | - $latest = 'C:\runner\cache\ymm4\latest.json' - New-Item -ItemType Directory -Force -Path (Split-Path $latest) | Out-Null - if (-not (Test-Path $latest) -or ((Get-Date) - (Get-Item $latest).LastWriteTime).TotalHours -gt 6) { - try { - Invoke-RestMethod -Uri "https://api.github.com/repos/manju-summoner/YukkuriMovieMaker4/releases/latest" `, - -Headers @{ "User-Agent" = "LuaScript-CI" } -ErrorAction Stop | ConvertTo-Json -Depth 20 | Set-Content -Path $latest -Encoding UTF8 - } - catch { - if (-not (Test-Path $latest)) { throw } - Write-Host "最新版の問い合わせに失敗したため、保存済みの情報を使います: $($_.Exception.Message)" - } - } - $release = Get-Content -Raw -Path $latest | ConvertFrom-Json - $asset = $release.assets | Where-Object { $_.name -like "*_Lite.zip" } | Select-Object -First 1 - if (-not $asset) { - $asset = $release.assets | Where-Object { $_.name -like "*.zip" } | Select-Object -First 1 - } - Write-Host "ダウンロード対象: $($asset.name)" - $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 - - - name: タグ名からバージョンを取得 - id: version - shell: pwsh - run: | - $tag = "${{ inputs.tag || github.ref_name }}" - echo "TAG=$tag" >> $env:GITHUB_OUTPUT - echo "VERSION=$($tag.TrimStart('v'))" >> $env:GITHUB_OUTPUT - - - name: プロジェクトのビルド - shell: pwsh - env: - CI: 'true' - run: | - dotnet build LuaScript/LuaScript.csproj ` - -c Release ` - -p:YMM4DirPath="${{ steps.ymm4.outputs.YMM4_DIR }}" ` - -p:Platform=x64 - - - name: パッケージの作成 - id: package - shell: pwsh - run: | - $version = "${{ steps.version.outputs.TAG }}" - $outDir = "LuaScript/bin/x64/Release/net10.0-windows10.0.19041.0" - $stageRoot = "stage/LuaScript" - $pkgName = "LuaScript_$version.ymme" - - New-Item -ItemType Directory -Path "$stageRoot/docs" -Force | Out-Null - New-Item -ItemType Directory -Path "$stageRoot/native" -Force | Out-Null - - Copy-Item "$outDir/LuaScript.dll" "$stageRoot/" - Copy-Item "$outDir/MoonSharp.Interpreter.dll" "$stageRoot/" - Copy-Item "$outDir/native/luajit.exe" "$stageRoot/native/" - Copy-Item "$outDir/native/lua51.dll" "$stageRoot/native/" - Copy-Item "$outDir/native/worker.lua" "$stageRoot/native/" - Copy-Item "$outDir/native/shim.lua" "$stageRoot/native/" - - foreach ($lang in @("ar-sa", "en-us", "es-es", "id-id", "ko-kr", "zh-cn", "zh-tw")) { - $src = "$outDir/$lang" - if (Test-Path $src) { - New-Item -ItemType Directory -Path "$stageRoot/$lang" -Force | Out-Null - Copy-Item "$src/*.dll" "$stageRoot/$lang/" - } - } - - Copy-Item "LuaScript/docs/LuaScript.*.txt" "$stageRoot/docs/" - Copy-Item ".github/Plugin_Readme.txt" "$stageRoot/Readme.txt" - - Compress-Archive -Path "stage/*" -DestinationPath $pkgName -CompressionLevel Optimal - echo "PKG_NAME=$pkgName" >> $env:GITHUB_OUTPUT - - - name: Gitea リリースの作成 - shell: pwsh - env: - GITEA_TOKEN: ${{ github.token }} - REPOSITORY: ${{ github.repository }} - SERVER_URL: ${{ github.server_url }} - RELEASE_TAG: ${{ inputs.tag || github.ref_name }} - RELEASE_NAME: ${{ steps.version.outputs.TAG }} - RELEASE_BODY: '' - RELEASE_BODY_PATH: .github/CHANGELOG.md - RELEASE_DRAFT: false - RELEASE_PRERELEASE: false - RELEASE_FILES: | - ${{ steps.package.outputs.PKG_NAME }} - run: | - $headers = @{ Authorization = "token $env:GITEA_TOKEN" } - $api = "$env:SERVER_URL/api/v1/repos/$env:REPOSITORY" - $tag = $env:RELEASE_TAG - - $body = $env:RELEASE_BODY - if ($env:RELEASE_BODY_PATH -and (Test-Path $env:RELEASE_BODY_PATH)) { - $body = Get-Content $env:RELEASE_BODY_PATH -Raw -Encoding utf8 - } - - $files = @() - foreach ($pattern in ($env:RELEASE_FILES -split "[`r`n,]+" | Where-Object { $_.Trim() })) { - $found = @(Get-ChildItem -Path $pattern.Trim() -File -ErrorAction SilentlyContinue) - if ($found.Count -eq 0) { throw "リリースに付けるファイルが見つかりません: $pattern" } - $files += $found - } - - $payload = @{ - tag_name = $tag - name = $env:RELEASE_NAME - body = [string]$body - draft = ($env:RELEASE_DRAFT -eq 'true') - prerelease = ($env:RELEASE_PRERELEASE -eq 'true') - } | ConvertTo-Json - $bytes = [System.Text.Encoding]::UTF8.GetBytes($payload) - - $existing = $null - try { $existing = Invoke-RestMethod -Uri "$api/releases/tags/$([System.Uri]::EscapeDataString($tag))" -Headers $headers } catch { } - if ($existing) { - $release = Invoke-RestMethod -Method Patch -Uri "$api/releases/$($existing.id)" -Headers $headers -ContentType "application/json; charset=utf-8" -Body $bytes - foreach ($asset in @($existing.assets)) { - Invoke-RestMethod -Method Delete -Uri "$api/releases/$($existing.id)/assets/$($asset.id)" -Headers $headers | Out-Null - } - } else { - $release = Invoke-RestMethod -Method Post -Uri "$api/releases" -Headers $headers -ContentType "application/json; charset=utf-8" -Body $bytes - } - foreach ($file in $files) { - $name = [System.Uri]::EscapeDataString($file.Name) - Invoke-RestMethod -Method Post -Uri "$api/releases/$($release.id)/assets?name=$name" -Headers $headers -Form @{ attachment = Get-Item $file.FullName } | Out-Null - Write-Host "添付しました: $($file.Name)" - } - Write-Host "リリースを作成しました: $($release.html_url)" - diff --git a/.gitea/workflows/release-44f043e8.yml b/.gitea/workflows/release-44f043e8.yml deleted file mode 100644 index 8d7783c..0000000 --- a/.gitea/workflows/release-44f043e8.yml +++ /dev/null @@ -1,193 +0,0 @@ -name: リリース - -on: - push: - tags: - - 'v*' - workflow_dispatch: - inputs: - tag: - description: リリースするタグ - required: true - -permissions: - contents: write - -jobs: - build-and-release: - runs-on: windows-latest - - steps: - - name: ソースコードのチェックアウト - uses: actions/checkout@v4 - env: - 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://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 - - - name: YMM4 最新リリースの取得と解凍 - id: ymm4 - shell: pwsh - run: | - $latest = 'C:\runner\cache\ymm4\latest.json' - New-Item -ItemType Directory -Force -Path (Split-Path $latest) | Out-Null - if (-not (Test-Path $latest) -or ((Get-Date) - (Get-Item $latest).LastWriteTime).TotalHours -gt 6) { - try { - Invoke-RestMethod -Uri "https://api.github.com/repos/manju-summoner/YukkuriMovieMaker4/releases/latest" `, - -Headers @{ "User-Agent" = "LuaScript-CI" } -ErrorAction Stop | ConvertTo-Json -Depth 20 | Set-Content -Path $latest -Encoding UTF8 - } - catch { - if (-not (Test-Path $latest)) { throw } - Write-Host "最新版の問い合わせに失敗したため、保存済みの情報を使います: $($_.Exception.Message)" - } - } - $release = Get-Content -Raw -Path $latest | ConvertFrom-Json - $asset = $release.assets | Where-Object { $_.name -like "*_Lite.zip" } | Select-Object -First 1 - if (-not $asset) { - $asset = $release.assets | Where-Object { $_.name -like "*.zip" } | Select-Object -First 1 - } - Write-Host "ダウンロード対象: $($asset.name)" - $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 - - - name: タグ名からバージョンを取得 - id: version - shell: pwsh - run: | - $tag = "${{ inputs.tag || github.ref_name }}" - echo "TAG=$tag" >> $env:GITHUB_OUTPUT - echo "VERSION=$($tag.TrimStart('v'))" >> $env:GITHUB_OUTPUT - - - name: プロジェクトのビルド - shell: pwsh - env: - CI: 'true' - run: | - dotnet build LuaScript/LuaScript.csproj ` - -c Release ` - -p:YMM4DirPath="${{ steps.ymm4.outputs.YMM4_DIR }}" ` - -p:Platform=x64 - - - name: パッケージの作成 - id: package - shell: pwsh - run: | - $version = "${{ steps.version.outputs.TAG }}" - $outDir = "LuaScript/bin/x64/Release/net10.0-windows10.0.19041.0" - $stageRoot = "stage/LuaScript" - $pkgName = "LuaScript_$version.ymme" - - New-Item -ItemType Directory -Path "$stageRoot/docs" -Force | Out-Null - New-Item -ItemType Directory -Path "$stageRoot/native" -Force | Out-Null - New-Item -ItemType Directory -Path "$stageRoot/LICENSE" -Force | Out-Null - - Copy-Item "$outDir/LuaScript.dll" "$stageRoot/" - Copy-Item "$outDir/LuaScript.Kernel.dll" "$stageRoot/" - Copy-Item "$outDir/LuaScript.Compat.dll" "$stageRoot/" - Copy-Item "$outDir/LuaScript.Media.dll" "$stageRoot/" - Copy-Item "$outDir/LuaScript.Runtime.dll" "$stageRoot/" - Copy-Item "$outDir/LuaScript.Gpu.dll" "$stageRoot/" - Copy-Item "$outDir/MoonSharp.Interpreter.dll" "$stageRoot/" - Copy-Item "$outDir/native/luajit.exe" "$stageRoot/native/" - Copy-Item "$outDir/native/lua51.dll" "$stageRoot/native/" - Copy-Item "$outDir/native/worker.lua" "$stageRoot/native/" - Copy-Item "$outDir/native/shim.lua" "$stageRoot/native/" - - foreach ($lang in @("ar-sa", "en-us", "es-es", "id-id", "ko-kr", "zh-cn", "zh-tw")) { - $src = "$outDir/$lang" - if (Test-Path $src) { - New-Item -ItemType Directory -Path "$stageRoot/$lang" -Force | Out-Null - Copy-Item "$src/*.dll" "$stageRoot/$lang/" - } - } - - Copy-Item "LuaScript/docs/LuaScript.*.txt" "$stageRoot/docs/" - Copy-Item ".github/LICENSE/*.txt" "$stageRoot/LICENSE/" - Copy-Item ".github/Plugin_Readme.txt" "$stageRoot/Readme.txt" - - Compress-Archive -Path "stage/*" -DestinationPath $pkgName -CompressionLevel Optimal - echo "PKG_NAME=$pkgName" >> $env:GITHUB_OUTPUT - - - name: Gitea リリースの作成 - shell: pwsh - env: - GITEA_TOKEN: ${{ github.token }} - REPOSITORY: ${{ github.repository }} - SERVER_URL: ${{ github.server_url }} - RELEASE_TAG: ${{ inputs.tag || github.ref_name }} - RELEASE_NAME: ${{ steps.version.outputs.TAG }} - RELEASE_BODY: '' - RELEASE_BODY_PATH: .github/CHANGELOG.md - RELEASE_DRAFT: false - RELEASE_PRERELEASE: false - RELEASE_FILES: | - ${{ steps.package.outputs.PKG_NAME }} - run: | - $headers = @{ Authorization = "token $env:GITEA_TOKEN" } - $api = "$env:SERVER_URL/api/v1/repos/$env:REPOSITORY" - $tag = $env:RELEASE_TAG - - $body = $env:RELEASE_BODY - if ($env:RELEASE_BODY_PATH -and (Test-Path $env:RELEASE_BODY_PATH)) { - $body = Get-Content $env:RELEASE_BODY_PATH -Raw -Encoding utf8 - } - - $files = @() - foreach ($pattern in ($env:RELEASE_FILES -split "[`r`n,]+" | Where-Object { $_.Trim() })) { - $found = @(Get-ChildItem -Path $pattern.Trim() -File -ErrorAction SilentlyContinue) - if ($found.Count -eq 0) { throw "リリースに付けるファイルが見つかりません: $pattern" } - $files += $found - } - - $payload = @{ - tag_name = $tag - name = $env:RELEASE_NAME - body = [string]$body - draft = ($env:RELEASE_DRAFT -eq 'true') - prerelease = ($env:RELEASE_PRERELEASE -eq 'true') - } | ConvertTo-Json - $bytes = [System.Text.Encoding]::UTF8.GetBytes($payload) - - $existing = $null - try { $existing = Invoke-RestMethod -Uri "$api/releases/tags/$([System.Uri]::EscapeDataString($tag))" -Headers $headers } catch { } - if ($existing) { - $release = Invoke-RestMethod -Method Patch -Uri "$api/releases/$($existing.id)" -Headers $headers -ContentType "application/json; charset=utf-8" -Body $bytes - foreach ($asset in @($existing.assets)) { - Invoke-RestMethod -Method Delete -Uri "$api/releases/$($existing.id)/assets/$($asset.id)" -Headers $headers | Out-Null - } - } else { - $release = Invoke-RestMethod -Method Post -Uri "$api/releases" -Headers $headers -ContentType "application/json; charset=utf-8" -Body $bytes - } - foreach ($file in $files) { - $name = [System.Uri]::EscapeDataString($file.Name) - Invoke-RestMethod -Method Post -Uri "$api/releases/$($release.id)/assets?name=$name" -Headers $headers -Form @{ attachment = Get-Item $file.FullName } | Out-Null - Write-Host "添付しました: $($file.Name)" - } - Write-Host "リリースを作成しました: $($release.html_url)" - diff --git a/.gitea/workflows/release-4ff05a72.yml b/.gitea/workflows/release-4ff05a72.yml deleted file mode 100644 index 1f3343f..0000000 --- a/.gitea/workflows/release-4ff05a72.yml +++ /dev/null @@ -1,193 +0,0 @@ -name: リリース - -on: - push: - tags: - - 'v*' - workflow_dispatch: - inputs: - tag: - description: リリースするタグ - required: true - -permissions: - contents: write - -jobs: - build-and-release: - runs-on: windows-latest - - steps: - - name: ソースコードのチェックアウト - uses: actions/checkout@v4 - env: - 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://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 - - - name: YMM4 最新リリースの取得と解凍 - id: ymm4 - shell: pwsh - run: | - $latest = 'C:\runner\cache\ymm4\latest.json' - New-Item -ItemType Directory -Force -Path (Split-Path $latest) | Out-Null - if (-not (Test-Path $latest) -or ((Get-Date) - (Get-Item $latest).LastWriteTime).TotalHours -gt 6) { - try { - Invoke-RestMethod -Uri "https://api.github.com/repos/manju-summoner/YukkuriMovieMaker4/releases/latest" ` - -Headers @{ "User-Agent" = "LuaScript-CI" } -ErrorAction Stop | ConvertTo-Json -Depth 20 | Set-Content -Path $latest -Encoding UTF8 - } - catch { - if (-not (Test-Path $latest)) { throw } - Write-Host "最新版の問い合わせに失敗したため、保存済みの情報を使います: $($_.Exception.Message)" - } - } - $release = Get-Content -Raw -Path $latest | ConvertFrom-Json - $asset = $release.assets | Where-Object { $_.name -like "*_Lite.zip" } | Select-Object -First 1 - if (-not $asset) { - $asset = $release.assets | Where-Object { $_.name -like "*.zip" } | Select-Object -First 1 - } - Write-Host "ダウンロード対象: $($asset.name)" - $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 - - - name: タグ名からバージョンを取得 - id: version - shell: pwsh - run: | - $tag = "${{ inputs.tag || github.ref_name }}" - echo "TAG=$tag" >> $env:GITHUB_OUTPUT - echo "VERSION=$($tag.TrimStart('v'))" >> $env:GITHUB_OUTPUT - - - name: プロジェクトのビルド - shell: pwsh - env: - CI: 'true' - run: | - dotnet build LuaScript/LuaScript.csproj ` - -c Release ` - -p:YMM4DirPath="${{ steps.ymm4.outputs.YMM4_DIR }}" ` - -p:Platform=x64 - - - name: パッケージの作成 - id: package - shell: pwsh - run: | - $version = "${{ steps.version.outputs.TAG }}" - $outDir = "LuaScript/bin/x64/Release/net10.0-windows10.0.19041.0" - $stageRoot = "stage/LuaScript" - $pkgName = "LuaScript_$version.ymme" - - New-Item -ItemType Directory -Path "$stageRoot/docs" -Force | Out-Null - New-Item -ItemType Directory -Path "$stageRoot/native" -Force | Out-Null - New-Item -ItemType Directory -Path "$stageRoot/LICENSE" -Force | Out-Null - - Copy-Item "$outDir/LuaScript.dll" "$stageRoot/" - Copy-Item "$outDir/LuaScript.Kernel.dll" "$stageRoot/" - Copy-Item "$outDir/LuaScript.Compat.dll" "$stageRoot/" - Copy-Item "$outDir/LuaScript.Media.dll" "$stageRoot/" - Copy-Item "$outDir/LuaScript.Runtime.dll" "$stageRoot/" - Copy-Item "$outDir/LuaScript.Gpu.dll" "$stageRoot/" - Copy-Item "$outDir/MoonSharp.Interpreter.dll" "$stageRoot/" - Copy-Item "$outDir/native/luajit.exe" "$stageRoot/native/" - Copy-Item "$outDir/native/lua51.dll" "$stageRoot/native/" - Copy-Item "$outDir/native/worker.lua" "$stageRoot/native/" - Copy-Item "$outDir/native/shim.lua" "$stageRoot/native/" - - foreach ($lang in @("ar-sa", "en-us", "es-es", "id-id", "ko-kr", "zh-cn", "zh-tw")) { - $src = "$outDir/$lang" - if (Test-Path $src) { - New-Item -ItemType Directory -Path "$stageRoot/$lang" -Force | Out-Null - Copy-Item "$src/*.dll" "$stageRoot/$lang/" - } - } - - Copy-Item "LuaScript/docs/LuaScript.*.txt" "$stageRoot/docs/" - Copy-Item ".github/LICENSE/*.txt" "$stageRoot/LICENSE/" - Copy-Item ".github/Plugin_Readme.txt" "$stageRoot/Readme.txt" - - Compress-Archive -Path "stage/*" -DestinationPath $pkgName -CompressionLevel Optimal - echo "PKG_NAME=$pkgName" >> $env:GITHUB_OUTPUT - - - name: Gitea リリースの作成 - shell: pwsh - env: - GITEA_TOKEN: ${{ github.token }} - REPOSITORY: ${{ github.repository }} - SERVER_URL: ${{ github.server_url }} - RELEASE_TAG: ${{ inputs.tag || github.ref_name }} - RELEASE_NAME: ${{ steps.version.outputs.TAG }} - RELEASE_BODY: '' - RELEASE_BODY_PATH: .github/CHANGELOG.md - RELEASE_DRAFT: false - RELEASE_PRERELEASE: false - RELEASE_FILES: | - ${{ steps.package.outputs.PKG_NAME }} - run: | - $headers = @{ Authorization = "token $env:GITEA_TOKEN" } - $api = "$env:SERVER_URL/api/v1/repos/$env:REPOSITORY" - $tag = $env:RELEASE_TAG - - $body = $env:RELEASE_BODY - if ($env:RELEASE_BODY_PATH -and (Test-Path $env:RELEASE_BODY_PATH)) { - $body = Get-Content $env:RELEASE_BODY_PATH -Raw -Encoding utf8 - } - - $files = @() - foreach ($pattern in ($env:RELEASE_FILES -split "[`r`n,]+" | Where-Object { $_.Trim() })) { - $found = @(Get-ChildItem -Path $pattern.Trim() -File -ErrorAction SilentlyContinue) - if ($found.Count -eq 0) { throw "リリースに付けるファイルが見つかりません: $pattern" } - $files += $found - } - - $payload = @{ - tag_name = $tag - name = $env:RELEASE_NAME - body = [string]$body - draft = ($env:RELEASE_DRAFT -eq 'true') - prerelease = ($env:RELEASE_PRERELEASE -eq 'true') - } | ConvertTo-Json - $bytes = [System.Text.Encoding]::UTF8.GetBytes($payload) - - $existing = $null - try { $existing = Invoke-RestMethod -Uri "$api/releases/tags/$([System.Uri]::EscapeDataString($tag))" -Headers $headers } catch { } - if ($existing) { - $release = Invoke-RestMethod -Method Patch -Uri "$api/releases/$($existing.id)" -Headers $headers -ContentType "application/json; charset=utf-8" -Body $bytes - foreach ($asset in @($existing.assets)) { - Invoke-RestMethod -Method Delete -Uri "$api/releases/$($existing.id)/assets/$($asset.id)" -Headers $headers | Out-Null - } - } else { - $release = Invoke-RestMethod -Method Post -Uri "$api/releases" -Headers $headers -ContentType "application/json; charset=utf-8" -Body $bytes - } - foreach ($file in $files) { - $name = [System.Uri]::EscapeDataString($file.Name) - Invoke-RestMethod -Method Post -Uri "$api/releases/$($release.id)/assets?name=$name" -Headers $headers -Form @{ attachment = Get-Item $file.FullName } | Out-Null - Write-Host "添付しました: $($file.Name)" - } - Write-Host "リリースを作成しました: $($release.html_url)" - diff --git a/.gitea/workflows/release-6812ba1e.yml b/.gitea/workflows/release-6812ba1e.yml deleted file mode 100644 index 1e9d705..0000000 --- a/.gitea/workflows/release-6812ba1e.yml +++ /dev/null @@ -1,182 +0,0 @@ -name: リリース - -on: - push: - tags: - - 'v*' - workflow_dispatch: - inputs: - tag: - description: リリースするタグ - required: true - -permissions: - contents: write - -jobs: - build-and-release: - runs-on: windows-latest - - steps: - - name: ソースコードのチェックアウト - uses: actions/checkout@v4 - env: - 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://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 - - - name: YMM4 最新リリースの取得と解凍 - id: ymm4 - shell: pwsh - run: | - $release = Invoke-RestMethod -Uri "https://api.github.com/repos/manju-summoner/YukkuriMovieMaker4/releases/latest" ` - -Headers @{ "User-Agent" = "LuaScript-CI" } - $asset = $release.assets | Where-Object { $_.name -like "*_Lite.zip" } | Select-Object -First 1 - if (-not $asset) { - $asset = $release.assets | Where-Object { $_.name -like "*.zip" } | Select-Object -First 1 - } - Write-Host "ダウンロード対象: $($asset.name)" - $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 - - - name: タグ名からバージョンを取得 - id: version - shell: pwsh - run: | - $tag = "${{ inputs.tag || github.ref_name }}" - echo "TAG=$tag" >> $env:GITHUB_OUTPUT - echo "VERSION=$($tag.TrimStart('v'))" >> $env:GITHUB_OUTPUT - - - name: プロジェクトのビルド - shell: pwsh - env: - CI: 'true' - run: | - dotnet build LuaScript/LuaScript.csproj ` - -c Release ` - -p:YMM4DirPath="${{ steps.ymm4.outputs.YMM4_DIR }}" ` - -p:Platform=x64 - - - name: パッケージの作成 - id: package - shell: pwsh - run: | - $version = "${{ steps.version.outputs.TAG }}" - $outDir = "LuaScript/bin/x64/Release/net10.0-windows10.0.19041.0" - $stageRoot = "stage/LuaScript" - $pkgName = "LuaScript_$version.ymme" - - New-Item -ItemType Directory -Path "$stageRoot/docs" -Force | Out-Null - New-Item -ItemType Directory -Path "$stageRoot/native" -Force | Out-Null - New-Item -ItemType Directory -Path "$stageRoot/LICENSE" -Force | Out-Null - - Copy-Item "$outDir/LuaScript.dll" "$stageRoot/" - Copy-Item "$outDir/LuaScript.Kernel.dll" "$stageRoot/" - Copy-Item "$outDir/LuaScript.Compat.dll" "$stageRoot/" - Copy-Item "$outDir/LuaScript.Media.dll" "$stageRoot/" - Copy-Item "$outDir/LuaScript.Runtime.dll" "$stageRoot/" - Copy-Item "$outDir/LuaScript.Gpu.dll" "$stageRoot/" - Copy-Item "$outDir/MoonSharp.Interpreter.dll" "$stageRoot/" - Copy-Item "$outDir/native/luajit.exe" "$stageRoot/native/" - Copy-Item "$outDir/native/lua51.dll" "$stageRoot/native/" - Copy-Item "$outDir/native/worker.lua" "$stageRoot/native/" - Copy-Item "$outDir/native/shim.lua" "$stageRoot/native/" - - foreach ($lang in @("ar-sa", "en-us", "es-es", "id-id", "ko-kr", "zh-cn", "zh-tw")) { - $src = "$outDir/$lang" - if (Test-Path $src) { - New-Item -ItemType Directory -Path "$stageRoot/$lang" -Force | Out-Null - Copy-Item "$src/*.dll" "$stageRoot/$lang/" - } - } - - Copy-Item "LuaScript/docs/LuaScript.*.txt" "$stageRoot/docs/" - Copy-Item ".github/LICENSE/*.txt" "$stageRoot/LICENSE/" - Copy-Item ".github/Plugin_Readme.txt" "$stageRoot/Readme.txt" - - Compress-Archive -Path "stage/*" -DestinationPath $pkgName -CompressionLevel Optimal - echo "PKG_NAME=$pkgName" >> $env:GITHUB_OUTPUT - - - name: Gitea リリースの作成 - shell: pwsh - env: - GITEA_TOKEN: ${{ github.token }} - REPOSITORY: ${{ github.repository }} - SERVER_URL: ${{ github.server_url }} - RELEASE_TAG: ${{ inputs.tag || github.ref_name }} - RELEASE_NAME: ${{ steps.version.outputs.TAG }} - RELEASE_BODY: '' - RELEASE_BODY_PATH: .github/CHANGELOG.md - RELEASE_DRAFT: false - RELEASE_PRERELEASE: false - RELEASE_FILES: | - ${{ steps.package.outputs.PKG_NAME }} - run: | - $headers = @{ Authorization = "token $env:GITEA_TOKEN" } - $api = "$env:SERVER_URL/api/v1/repos/$env:REPOSITORY" - $tag = $env:RELEASE_TAG - - $body = $env:RELEASE_BODY - if ($env:RELEASE_BODY_PATH -and (Test-Path $env:RELEASE_BODY_PATH)) { - $body = Get-Content $env:RELEASE_BODY_PATH -Raw -Encoding utf8 - } - - $files = @() - foreach ($pattern in ($env:RELEASE_FILES -split "[`r`n,]+" | Where-Object { $_.Trim() })) { - $found = @(Get-ChildItem -Path $pattern.Trim() -File -ErrorAction SilentlyContinue) - if ($found.Count -eq 0) { throw "リリースに付けるファイルが見つかりません: $pattern" } - $files += $found - } - - $payload = @{ - tag_name = $tag - name = $env:RELEASE_NAME - body = [string]$body - draft = ($env:RELEASE_DRAFT -eq 'true') - prerelease = ($env:RELEASE_PRERELEASE -eq 'true') - } | ConvertTo-Json - $bytes = [System.Text.Encoding]::UTF8.GetBytes($payload) - - $existing = $null - try { $existing = Invoke-RestMethod -Uri "$api/releases/tags/$([System.Uri]::EscapeDataString($tag))" -Headers $headers } catch { } - if ($existing) { - $release = Invoke-RestMethod -Method Patch -Uri "$api/releases/$($existing.id)" -Headers $headers -ContentType "application/json; charset=utf-8" -Body $bytes - foreach ($asset in @($existing.assets)) { - Invoke-RestMethod -Method Delete -Uri "$api/releases/$($existing.id)/assets/$($asset.id)" -Headers $headers | Out-Null - } - } else { - $release = Invoke-RestMethod -Method Post -Uri "$api/releases" -Headers $headers -ContentType "application/json; charset=utf-8" -Body $bytes - } - foreach ($file in $files) { - $name = [System.Uri]::EscapeDataString($file.Name) - Invoke-RestMethod -Method Post -Uri "$api/releases/$($release.id)/assets?name=$name" -Headers $headers -Form @{ attachment = Get-Item $file.FullName } | Out-Null - Write-Host "添付しました: $($file.Name)" - } - Write-Host "リリースを作成しました: $($release.html_url)" - diff --git a/.gitea/workflows/release-69b7d822.yml b/.gitea/workflows/release-69b7d822.yml deleted file mode 100644 index 432ff1e..0000000 --- a/.gitea/workflows/release-69b7d822.yml +++ /dev/null @@ -1,192 +0,0 @@ -name: リリース - -on: - push: - tags: - - 'v*' - workflow_dispatch: - inputs: - tag: - description: リリースするタグ - required: true - -permissions: - contents: write - -jobs: - build-and-release: - runs-on: windows-latest - - steps: - - name: ソースコードのチェックアウト - uses: actions/checkout@v4 - env: - 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://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 - - - name: YMM4 最新リリースの取得と解凍 - id: ymm4 - shell: pwsh - run: | - $latest = 'C:\runner\cache\ymm4\latest.json' - New-Item -ItemType Directory -Force -Path (Split-Path $latest) | Out-Null - if (-not (Test-Path $latest) -or ((Get-Date) - (Get-Item $latest).LastWriteTime).TotalHours -gt 6) { - try { - Invoke-RestMethod -Uri "https://api.github.com/repos/manju-summoner/YukkuriMovieMaker4/releases/latest" ` - -Headers @{ "User-Agent" = "LuaScript-CI" } -ErrorAction Stop | ConvertTo-Json -Depth 20 | Set-Content -Path $latest -Encoding UTF8 - } - catch { - if (-not (Test-Path $latest)) { throw } - Write-Host "最新版の問い合わせに失敗したため、保存済みの情報を使います: $($_.Exception.Message)" - } - } - $release = Get-Content -Raw -Path $latest | ConvertFrom-Json - $asset = $release.assets | Where-Object { $_.name -like "*_Lite.zip" } | Select-Object -First 1 - if (-not $asset) { - $asset = $release.assets | Where-Object { $_.name -like "*.zip" } | Select-Object -First 1 - } - Write-Host "ダウンロード対象: $($asset.name)" - $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 - - - name: タグ名からバージョンを取得 - id: version - shell: pwsh - run: | - $tag = "${{ inputs.tag || github.ref_name }}" - echo "TAG=$tag" >> $env:GITHUB_OUTPUT - echo "VERSION=$($tag.TrimStart('v'))" >> $env:GITHUB_OUTPUT - - - name: プロジェクトのビルド - shell: pwsh - env: - CI: 'true' - run: | - dotnet build LuaScript/LuaScript.csproj ` - -c Release ` - -p:YMM4DirPath="${{ steps.ymm4.outputs.YMM4_DIR }}" ` - -p:Platform=x64 - - - name: パッケージの作成 - id: package - shell: pwsh - run: | - $version = "${{ steps.version.outputs.TAG }}" - $outDir = "LuaScript/bin/x64/Release/net10.0-windows10.0.19041.0" - $stageRoot = "stage/LuaScript" - $pkgName = "LuaScript_$version.ymme" - - New-Item -ItemType Directory -Path "$stageRoot/docs" -Force | Out-Null - New-Item -ItemType Directory -Path "$stageRoot/native" -Force | Out-Null - New-Item -ItemType Directory -Path "$stageRoot/LICENSE" -Force | Out-Null - - Copy-Item "$outDir/LuaScript.dll" "$stageRoot/" - Copy-Item "$outDir/LuaScript.Kernel.dll" "$stageRoot/" - Copy-Item "$outDir/LuaScript.Compat.dll" "$stageRoot/" - Copy-Item "$outDir/LuaScript.Media.dll" "$stageRoot/" - Copy-Item "$outDir/LuaScript.Runtime.dll" "$stageRoot/" - Copy-Item "$outDir/MoonSharp.Interpreter.dll" "$stageRoot/" - Copy-Item "$outDir/native/luajit.exe" "$stageRoot/native/" - Copy-Item "$outDir/native/lua51.dll" "$stageRoot/native/" - Copy-Item "$outDir/native/worker.lua" "$stageRoot/native/" - Copy-Item "$outDir/native/shim.lua" "$stageRoot/native/" - - foreach ($lang in @("ar-sa", "en-us", "es-es", "id-id", "ko-kr", "zh-cn", "zh-tw")) { - $src = "$outDir/$lang" - if (Test-Path $src) { - New-Item -ItemType Directory -Path "$stageRoot/$lang" -Force | Out-Null - Copy-Item "$src/*.dll" "$stageRoot/$lang/" - } - } - - Copy-Item "LuaScript/docs/LuaScript.*.txt" "$stageRoot/docs/" - Copy-Item ".github/LICENSE/*.txt" "$stageRoot/LICENSE/" - Copy-Item ".github/Plugin_Readme.txt" "$stageRoot/Readme.txt" - - Compress-Archive -Path "stage/*" -DestinationPath $pkgName -CompressionLevel Optimal - echo "PKG_NAME=$pkgName" >> $env:GITHUB_OUTPUT - - - name: Gitea リリースの作成 - shell: pwsh - env: - GITEA_TOKEN: ${{ github.token }} - REPOSITORY: ${{ github.repository }} - SERVER_URL: ${{ github.server_url }} - RELEASE_TAG: ${{ inputs.tag || github.ref_name }} - RELEASE_NAME: ${{ steps.version.outputs.TAG }} - RELEASE_BODY: '' - RELEASE_BODY_PATH: .github/CHANGELOG.md - RELEASE_DRAFT: false - RELEASE_PRERELEASE: false - RELEASE_FILES: | - ${{ steps.package.outputs.PKG_NAME }} - run: | - $headers = @{ Authorization = "token $env:GITEA_TOKEN" } - $api = "$env:SERVER_URL/api/v1/repos/$env:REPOSITORY" - $tag = $env:RELEASE_TAG - - $body = $env:RELEASE_BODY - if ($env:RELEASE_BODY_PATH -and (Test-Path $env:RELEASE_BODY_PATH)) { - $body = Get-Content $env:RELEASE_BODY_PATH -Raw -Encoding utf8 - } - - $files = @() - foreach ($pattern in ($env:RELEASE_FILES -split "[`r`n,]+" | Where-Object { $_.Trim() })) { - $found = @(Get-ChildItem -Path $pattern.Trim() -File -ErrorAction SilentlyContinue) - if ($found.Count -eq 0) { throw "リリースに付けるファイルが見つかりません: $pattern" } - $files += $found - } - - $payload = @{ - tag_name = $tag - name = $env:RELEASE_NAME - body = [string]$body - draft = ($env:RELEASE_DRAFT -eq 'true') - prerelease = ($env:RELEASE_PRERELEASE -eq 'true') - } | ConvertTo-Json - $bytes = [System.Text.Encoding]::UTF8.GetBytes($payload) - - $existing = $null - try { $existing = Invoke-RestMethod -Uri "$api/releases/tags/$([System.Uri]::EscapeDataString($tag))" -Headers $headers } catch { } - if ($existing) { - $release = Invoke-RestMethod -Method Patch -Uri "$api/releases/$($existing.id)" -Headers $headers -ContentType "application/json; charset=utf-8" -Body $bytes - foreach ($asset in @($existing.assets)) { - Invoke-RestMethod -Method Delete -Uri "$api/releases/$($existing.id)/assets/$($asset.id)" -Headers $headers | Out-Null - } - } else { - $release = Invoke-RestMethod -Method Post -Uri "$api/releases" -Headers $headers -ContentType "application/json; charset=utf-8" -Body $bytes - } - foreach ($file in $files) { - $name = [System.Uri]::EscapeDataString($file.Name) - Invoke-RestMethod -Method Post -Uri "$api/releases/$($release.id)/assets?name=$name" -Headers $headers -Form @{ attachment = Get-Item $file.FullName } | Out-Null - Write-Host "添付しました: $($file.Name)" - } - Write-Host "リリースを作成しました: $($release.html_url)" - diff --git a/.gitea/workflows/release-6a01bf64.yml b/.gitea/workflows/release-6a01bf64.yml deleted file mode 100644 index 567c988..0000000 --- a/.gitea/workflows/release-6a01bf64.yml +++ /dev/null @@ -1,181 +0,0 @@ -name: リリース - -on: - push: - tags: - - 'v*' - workflow_dispatch: - inputs: - tag: - description: リリースするタグ - required: true - -permissions: - contents: write - -jobs: - build-and-release: - runs-on: windows-latest - - steps: - - name: ソースコードのチェックアウト - uses: actions/checkout@v4 - env: - 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://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 - - - name: YMM4 最新リリースの取得と解凍 - id: ymm4 - shell: pwsh - run: | - $latest = 'C:\runner\cache\ymm4\latest.json' - New-Item -ItemType Directory -Force -Path (Split-Path $latest) | Out-Null - if (-not (Test-Path $latest) -or ((Get-Date) - (Get-Item $latest).LastWriteTime).TotalHours -gt 6) { - try { - Invoke-RestMethod -Uri "https://api.github.com/repos/manju-summoner/YukkuriMovieMaker4/releases/latest" `, - -Headers @{ "User-Agent" = "LuaScript-CI" } -ErrorAction Stop | ConvertTo-Json -Depth 20 | Set-Content -Path $latest -Encoding UTF8 - } - catch { - if (-not (Test-Path $latest)) { throw } - Write-Host "最新版の問い合わせに失敗したため、保存済みの情報を使います: $($_.Exception.Message)" - } - } - $release = Get-Content -Raw -Path $latest | ConvertFrom-Json - $asset = $release.assets | Where-Object { $_.name -like "*_Lite.zip" } | Select-Object -First 1 - if (-not $asset) { - $asset = $release.assets | Where-Object { $_.name -like "*.zip" } | Select-Object -First 1 - } - Write-Host "ダウンロード対象: $($asset.name)" - $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 - - - name: タグ名からバージョンを取得 - id: version - shell: pwsh - run: | - $tag = "${{ inputs.tag || github.ref_name }}" - echo "TAG=$tag" >> $env:GITHUB_OUTPUT - echo "VERSION=$($tag.TrimStart('v'))" >> $env:GITHUB_OUTPUT - - - name: プロジェクトのビルド - shell: pwsh - env: - CI: 'true' - run: | - dotnet build LuaScript/LuaScript.csproj ` - -c Release ` - -p:YMM4DirPath="${{ steps.ymm4.outputs.YMM4_DIR }}" ` - -p:Platform=x64 - - - name: パッケージの作成 - id: package - shell: pwsh - run: | - $version = "${{ steps.version.outputs.TAG }}" - $outDir = "LuaScript/bin/x64/Release/net10.0-windows10.0.19041.0" - $stageRoot = "stage/LuaScript" - $pkgName = "LuaScript_$version.ymme" - - New-Item -ItemType Directory -Path "$stageRoot/docs" -Force | Out-Null - - Copy-Item "$outDir/LuaScript.dll" "$stageRoot/" - Copy-Item "$outDir/MoonSharp.Interpreter.dll" "$stageRoot/" - - foreach ($lang in @("ar-sa", "en-us", "es-es", "id-id", "ko-kr", "zh-cn", "zh-tw")) { - $src = "$outDir/$lang" - if (Test-Path $src) { - New-Item -ItemType Directory -Path "$stageRoot/$lang" -Force | Out-Null - Copy-Item "$src/*.dll" "$stageRoot/$lang/" - } - } - - Copy-Item "LuaScript/docs/LuaScript.*.txt" "$stageRoot/docs/" - Copy-Item ".github/Plugin_Readme.txt" "$stageRoot/Readme.txt" - - Compress-Archive -Path "stage/*" -DestinationPath $pkgName -CompressionLevel Optimal - echo "PKG_NAME=$pkgName" >> $env:GITHUB_OUTPUT - - - name: Gitea リリースの作成 - shell: pwsh - env: - GITEA_TOKEN: ${{ github.token }} - REPOSITORY: ${{ github.repository }} - SERVER_URL: ${{ github.server_url }} - RELEASE_TAG: ${{ inputs.tag || github.ref_name }} - RELEASE_NAME: ${{ steps.version.outputs.TAG }} - RELEASE_BODY: '' - RELEASE_BODY_PATH: .github/CHANGELOG.md - RELEASE_DRAFT: false - RELEASE_PRERELEASE: false - RELEASE_FILES: | - ${{ steps.package.outputs.PKG_NAME }} - run: | - $headers = @{ Authorization = "token $env:GITEA_TOKEN" } - $api = "$env:SERVER_URL/api/v1/repos/$env:REPOSITORY" - $tag = $env:RELEASE_TAG - - $body = $env:RELEASE_BODY - if ($env:RELEASE_BODY_PATH -and (Test-Path $env:RELEASE_BODY_PATH)) { - $body = Get-Content $env:RELEASE_BODY_PATH -Raw -Encoding utf8 - } - - $files = @() - foreach ($pattern in ($env:RELEASE_FILES -split "[`r`n,]+" | Where-Object { $_.Trim() })) { - $found = @(Get-ChildItem -Path $pattern.Trim() -File -ErrorAction SilentlyContinue) - if ($found.Count -eq 0) { throw "リリースに付けるファイルが見つかりません: $pattern" } - $files += $found - } - - $payload = @{ - tag_name = $tag - name = $env:RELEASE_NAME - body = [string]$body - draft = ($env:RELEASE_DRAFT -eq 'true') - prerelease = ($env:RELEASE_PRERELEASE -eq 'true') - } | ConvertTo-Json - $bytes = [System.Text.Encoding]::UTF8.GetBytes($payload) - - $existing = $null - try { $existing = Invoke-RestMethod -Uri "$api/releases/tags/$([System.Uri]::EscapeDataString($tag))" -Headers $headers } catch { } - if ($existing) { - $release = Invoke-RestMethod -Method Patch -Uri "$api/releases/$($existing.id)" -Headers $headers -ContentType "application/json; charset=utf-8" -Body $bytes - foreach ($asset in @($existing.assets)) { - Invoke-RestMethod -Method Delete -Uri "$api/releases/$($existing.id)/assets/$($asset.id)" -Headers $headers | Out-Null - } - } else { - $release = Invoke-RestMethod -Method Post -Uri "$api/releases" -Headers $headers -ContentType "application/json; charset=utf-8" -Body $bytes - } - foreach ($file in $files) { - $name = [System.Uri]::EscapeDataString($file.Name) - Invoke-RestMethod -Method Post -Uri "$api/releases/$($release.id)/assets?name=$name" -Headers $headers -Form @{ attachment = Get-Item $file.FullName } | Out-Null - Write-Host "添付しました: $($file.Name)" - } - Write-Host "リリースを作成しました: $($release.html_url)" - diff --git a/.gitea/workflows/release-7111537b.yml b/.gitea/workflows/release-7111537b.yml deleted file mode 100644 index bb79a34..0000000 --- a/.gitea/workflows/release-7111537b.yml +++ /dev/null @@ -1,175 +0,0 @@ -name: リリース - -on: - push: - tags: - - 'v*' - workflow_dispatch: - inputs: - tag: - description: リリースするタグ - required: true - -permissions: - contents: write - -jobs: - build-and-release: - runs-on: windows-latest - - steps: - - name: ソースコードのチェックアウト - uses: actions/checkout@v4 - env: - 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://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 - - - name: YMM4 最新リリースの取得と解凍 - id: ymm4 - shell: pwsh - run: | - $release = Invoke-RestMethod -Uri "https://api.github.com/repos/manju-summoner/YukkuriMovieMaker4/releases/latest" ` - -Headers @{ "User-Agent" = "LuaScript-CI" } - $asset = $release.assets | Where-Object { $_.name -like "*_Lite.zip" } | Select-Object -First 1 - if (-not $asset) { - $asset = $release.assets | Where-Object { $_.name -like "*.zip" } | Select-Object -First 1 - } - Write-Host "ダウンロード対象: $($asset.name)" - $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 - - - name: タグ名からバージョンを取得 - id: version - shell: pwsh - run: | - $tag = "${{ inputs.tag || github.ref_name }}" - echo "TAG=$tag" >> $env:GITHUB_OUTPUT - echo "VERSION=$($tag.TrimStart('v'))" >> $env:GITHUB_OUTPUT - - - name: プロジェクトのビルド - shell: pwsh - env: - CI: 'true' - run: | - dotnet build LuaScript/LuaScript.csproj ` - -c Release ` - -p:YMM4DirPath="${{ steps.ymm4.outputs.YMM4_DIR }}" ` - -p:Platform=x64 - - - name: パッケージの作成 - id: package - shell: pwsh - run: | - $version = "${{ steps.version.outputs.TAG }}" - $outDir = "LuaScript/bin/x64/Release/net10.0-windows10.0.19041.0" - $stageRoot = "stage/LuaScript" - $pkgName = "LuaScript_$version.ymme" - - New-Item -ItemType Directory -Path "$stageRoot/docs" -Force | Out-Null - New-Item -ItemType Directory -Path "$stageRoot/native" -Force | Out-Null - - Copy-Item "$outDir/LuaScript.dll" "$stageRoot/" - Copy-Item "$outDir/MoonSharp.Interpreter.dll" "$stageRoot/" - Copy-Item "$outDir/native/luajit.exe" "$stageRoot/native/" - Copy-Item "$outDir/native/lua51.dll" "$stageRoot/native/" - Copy-Item "$outDir/native/worker.lua" "$stageRoot/native/" - Copy-Item "$outDir/native/shim.lua" "$stageRoot/native/" - - foreach ($lang in @("ar-sa", "en-us", "es-es", "id-id", "ko-kr", "zh-cn", "zh-tw")) { - $src = "$outDir/$lang" - if (Test-Path $src) { - New-Item -ItemType Directory -Path "$stageRoot/$lang" -Force | Out-Null - Copy-Item "$src/*.dll" "$stageRoot/$lang/" - } - } - - Copy-Item "LuaScript/docs/LuaScript.*.txt" "$stageRoot/docs/" - Copy-Item ".github/Plugin_Readme.txt" "$stageRoot/Readme.txt" - - Compress-Archive -Path "stage/*" -DestinationPath $pkgName -CompressionLevel Optimal - echo "PKG_NAME=$pkgName" >> $env:GITHUB_OUTPUT - - - name: Gitea リリースの作成 - shell: pwsh - env: - GITEA_TOKEN: ${{ github.token }} - REPOSITORY: ${{ github.repository }} - SERVER_URL: ${{ github.server_url }} - RELEASE_TAG: ${{ inputs.tag || github.ref_name }} - RELEASE_NAME: ${{ steps.version.outputs.TAG }} - RELEASE_BODY: '' - RELEASE_BODY_PATH: .github/CHANGELOG.md - RELEASE_DRAFT: false - RELEASE_PRERELEASE: false - RELEASE_FILES: | - ${{ steps.package.outputs.PKG_NAME }} - run: | - $headers = @{ Authorization = "token $env:GITEA_TOKEN" } - $api = "$env:SERVER_URL/api/v1/repos/$env:REPOSITORY" - $tag = $env:RELEASE_TAG - - $body = $env:RELEASE_BODY - if ($env:RELEASE_BODY_PATH -and (Test-Path $env:RELEASE_BODY_PATH)) { - $body = Get-Content $env:RELEASE_BODY_PATH -Raw -Encoding utf8 - } - - $files = @() - foreach ($pattern in ($env:RELEASE_FILES -split "[`r`n,]+" | Where-Object { $_.Trim() })) { - $found = @(Get-ChildItem -Path $pattern.Trim() -File -ErrorAction SilentlyContinue) - if ($found.Count -eq 0) { throw "リリースに付けるファイルが見つかりません: $pattern" } - $files += $found - } - - $payload = @{ - tag_name = $tag - name = $env:RELEASE_NAME - body = [string]$body - draft = ($env:RELEASE_DRAFT -eq 'true') - prerelease = ($env:RELEASE_PRERELEASE -eq 'true') - } | ConvertTo-Json - $bytes = [System.Text.Encoding]::UTF8.GetBytes($payload) - - $existing = $null - try { $existing = Invoke-RestMethod -Uri "$api/releases/tags/$([System.Uri]::EscapeDataString($tag))" -Headers $headers } catch { } - if ($existing) { - $release = Invoke-RestMethod -Method Patch -Uri "$api/releases/$($existing.id)" -Headers $headers -ContentType "application/json; charset=utf-8" -Body $bytes - foreach ($asset in @($existing.assets)) { - Invoke-RestMethod -Method Delete -Uri "$api/releases/$($existing.id)/assets/$($asset.id)" -Headers $headers | Out-Null - } - } else { - $release = Invoke-RestMethod -Method Post -Uri "$api/releases" -Headers $headers -ContentType "application/json; charset=utf-8" -Body $bytes - } - foreach ($file in $files) { - $name = [System.Uri]::EscapeDataString($file.Name) - Invoke-RestMethod -Method Post -Uri "$api/releases/$($release.id)/assets?name=$name" -Headers $headers -Form @{ attachment = Get-Item $file.FullName } | Out-Null - Write-Host "添付しました: $($file.Name)" - } - Write-Host "リリースを作成しました: $($release.html_url)" - diff --git a/.gitea/workflows/release-84ddcb28.yml b/.gitea/workflows/release-84ddcb28.yml deleted file mode 100644 index 9cba8e7..0000000 --- a/.gitea/workflows/release-84ddcb28.yml +++ /dev/null @@ -1,181 +0,0 @@ -name: リリース - -on: - push: - tags: - - 'v*' - workflow_dispatch: - inputs: - tag: - description: リリースするタグ - required: true - -permissions: - contents: write - -jobs: - build-and-release: - runs-on: windows-latest - - steps: - - name: ソースコードのチェックアウト - uses: actions/checkout@v4 - env: - 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://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 - - - name: YMM4 最新リリースの取得と解凍 - id: ymm4 - shell: pwsh - run: | - $latest = 'C:\runner\cache\ymm4\latest.json' - New-Item -ItemType Directory -Force -Path (Split-Path $latest) | Out-Null - if (-not (Test-Path $latest) -or ((Get-Date) - (Get-Item $latest).LastWriteTime).TotalHours -gt 6) { - try { - Invoke-RestMethod -Uri "https://api.github.com/repos/manju-summoner/YukkuriMovieMaker4/releases/latest" ` - -Headers @{ "User-Agent" = "LuaScript-CI" } -ErrorAction Stop | ConvertTo-Json -Depth 20 | Set-Content -Path $latest -Encoding UTF8 - } - catch { - if (-not (Test-Path $latest)) { throw } - Write-Host "最新版の問い合わせに失敗したため、保存済みの情報を使います: $($_.Exception.Message)" - } - } - $release = Get-Content -Raw -Path $latest | ConvertFrom-Json - $asset = $release.assets | Where-Object { $_.name -like "*_Lite.zip" } | Select-Object -First 1 - if (-not $asset) { - $asset = $release.assets | Where-Object { $_.name -like "*.zip" } | Select-Object -First 1 - } - Write-Host "ダウンロード対象: $($asset.name)" - $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 - - - name: タグ名からバージョンを取得 - id: version - shell: pwsh - run: | - $tag = "${{ inputs.tag || github.ref_name }}" - echo "TAG=$tag" >> $env:GITHUB_OUTPUT - echo "VERSION=$($tag.TrimStart('v'))" >> $env:GITHUB_OUTPUT - - - name: プロジェクトのビルド - shell: pwsh - env: - CI: 'true' - run: | - dotnet build LuaScript/LuaScript.csproj ` - -c Release ` - -p:YMM4DirPath="${{ steps.ymm4.outputs.YMM4_DIR }}" ` - -p:Platform=x64 - - - name: パッケージの作成 - id: package - shell: pwsh - run: | - $version = "${{ steps.version.outputs.TAG }}" - $outDir = "LuaScript/bin/x64/Release/net10.0-windows10.0.19041.0" - $stageRoot = "stage/LuaScript" - $pkgName = "LuaScript_$version.ymme" - - New-Item -ItemType Directory -Path "$stageRoot/docs" -Force | Out-Null - - Copy-Item "$outDir/LuaScript.dll" "$stageRoot/" - Copy-Item "$outDir/MoonSharp.Interpreter.dll" "$stageRoot/" - - foreach ($lang in @("ar-sa", "en-us", "es-es", "id-id", "ko-kr", "zh-cn", "zh-tw")) { - $src = "$outDir/$lang" - if (Test-Path $src) { - New-Item -ItemType Directory -Path "$stageRoot/$lang" -Force | Out-Null - Copy-Item "$src/*.dll" "$stageRoot/$lang/" - } - } - - Copy-Item "LuaScript/docs/LuaScript.*.txt" "$stageRoot/docs/" - Copy-Item ".github/Plugin_Readme.txt" "$stageRoot/Readme.txt" - - Compress-Archive -Path "stage/*" -DestinationPath $pkgName -CompressionLevel Optimal - echo "PKG_NAME=$pkgName" >> $env:GITHUB_OUTPUT - - - name: Gitea リリースの作成 - shell: pwsh - env: - GITEA_TOKEN: ${{ github.token }} - REPOSITORY: ${{ github.repository }} - SERVER_URL: ${{ github.server_url }} - RELEASE_TAG: ${{ inputs.tag || github.ref_name }} - RELEASE_NAME: ${{ steps.version.outputs.TAG }} - RELEASE_BODY: '' - RELEASE_BODY_PATH: .github/CHANGELOG.md - RELEASE_DRAFT: false - RELEASE_PRERELEASE: false - RELEASE_FILES: | - ${{ steps.package.outputs.PKG_NAME }} - run: | - $headers = @{ Authorization = "token $env:GITEA_TOKEN" } - $api = "$env:SERVER_URL/api/v1/repos/$env:REPOSITORY" - $tag = $env:RELEASE_TAG - - $body = $env:RELEASE_BODY - if ($env:RELEASE_BODY_PATH -and (Test-Path $env:RELEASE_BODY_PATH)) { - $body = Get-Content $env:RELEASE_BODY_PATH -Raw -Encoding utf8 - } - - $files = @() - foreach ($pattern in ($env:RELEASE_FILES -split "[`r`n,]+" | Where-Object { $_.Trim() })) { - $found = @(Get-ChildItem -Path $pattern.Trim() -File -ErrorAction SilentlyContinue) - if ($found.Count -eq 0) { throw "リリースに付けるファイルが見つかりません: $pattern" } - $files += $found - } - - $payload = @{ - tag_name = $tag - name = $env:RELEASE_NAME - body = [string]$body - draft = ($env:RELEASE_DRAFT -eq 'true') - prerelease = ($env:RELEASE_PRERELEASE -eq 'true') - } | ConvertTo-Json - $bytes = [System.Text.Encoding]::UTF8.GetBytes($payload) - - $existing = $null - try { $existing = Invoke-RestMethod -Uri "$api/releases/tags/$([System.Uri]::EscapeDataString($tag))" -Headers $headers } catch { } - if ($existing) { - $release = Invoke-RestMethod -Method Patch -Uri "$api/releases/$($existing.id)" -Headers $headers -ContentType "application/json; charset=utf-8" -Body $bytes - foreach ($asset in @($existing.assets)) { - Invoke-RestMethod -Method Delete -Uri "$api/releases/$($existing.id)/assets/$($asset.id)" -Headers $headers | Out-Null - } - } else { - $release = Invoke-RestMethod -Method Post -Uri "$api/releases" -Headers $headers -ContentType "application/json; charset=utf-8" -Body $bytes - } - foreach ($file in $files) { - $name = [System.Uri]::EscapeDataString($file.Name) - Invoke-RestMethod -Method Post -Uri "$api/releases/$($release.id)/assets?name=$name" -Headers $headers -Form @{ attachment = Get-Item $file.FullName } | Out-Null - Write-Host "添付しました: $($file.Name)" - } - Write-Host "リリースを作成しました: $($release.html_url)" - diff --git a/.gitea/workflows/release-c4fc43f1.yml b/.gitea/workflows/release-c4fc43f1.yml deleted file mode 100644 index 674b36b..0000000 --- a/.gitea/workflows/release-c4fc43f1.yml +++ /dev/null @@ -1,181 +0,0 @@ -name: リリース - -on: - push: - tags: - - 'v*' - workflow_dispatch: - inputs: - tag: - description: リリースするタグ - required: true - -permissions: - contents: write - -jobs: - build-and-release: - runs-on: windows-latest - - steps: - - name: ソースコードのチェックアウト - uses: actions/checkout@v4 - env: - 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://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 - - - name: YMM4 最新リリースの取得と解凍 - id: ymm4 - shell: pwsh - run: | - $release = Invoke-RestMethod -Uri "https://api.github.com/repos/manju-summoner/YukkuriMovieMaker4/releases/latest" ` - -Headers @{ "User-Agent" = "LuaScript-CI" } - $asset = $release.assets | Where-Object { $_.name -like "*_Lite.zip" } | Select-Object -First 1 - if (-not $asset) { - $asset = $release.assets | Where-Object { $_.name -like "*.zip" } | Select-Object -First 1 - } - Write-Host "ダウンロード対象: $($asset.name)" - $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 - - - name: タグ名からバージョンを取得 - id: version - shell: pwsh - run: | - $tag = "${{ inputs.tag || github.ref_name }}" - echo "TAG=$tag" >> $env:GITHUB_OUTPUT - echo "VERSION=$($tag.TrimStart('v'))" >> $env:GITHUB_OUTPUT - - - name: プロジェクトのビルド - shell: pwsh - env: - CI: 'true' - run: | - dotnet build LuaScript/LuaScript.csproj ` - -c Release ` - -p:YMM4DirPath="${{ steps.ymm4.outputs.YMM4_DIR }}" ` - -p:Platform=x64 - - - name: パッケージの作成 - id: package - shell: pwsh - run: | - $version = "${{ steps.version.outputs.TAG }}" - $outDir = "LuaScript/bin/x64/Release/net10.0-windows10.0.19041.0" - $stageRoot = "stage/LuaScript" - $pkgName = "LuaScript_$version.ymme" - - New-Item -ItemType Directory -Path "$stageRoot/docs" -Force | Out-Null - New-Item -ItemType Directory -Path "$stageRoot/native" -Force | Out-Null - New-Item -ItemType Directory -Path "$stageRoot/LICENSE" -Force | Out-Null - - Copy-Item "$outDir/LuaScript.dll" "$stageRoot/" - Copy-Item "$outDir/LuaScript.Kernel.dll" "$stageRoot/" - Copy-Item "$outDir/LuaScript.Compat.dll" "$stageRoot/" - Copy-Item "$outDir/LuaScript.Media.dll" "$stageRoot/" - Copy-Item "$outDir/LuaScript.Runtime.dll" "$stageRoot/" - Copy-Item "$outDir/MoonSharp.Interpreter.dll" "$stageRoot/" - Copy-Item "$outDir/native/luajit.exe" "$stageRoot/native/" - Copy-Item "$outDir/native/lua51.dll" "$stageRoot/native/" - Copy-Item "$outDir/native/worker.lua" "$stageRoot/native/" - Copy-Item "$outDir/native/shim.lua" "$stageRoot/native/" - - foreach ($lang in @("ar-sa", "en-us", "es-es", "id-id", "ko-kr", "zh-cn", "zh-tw")) { - $src = "$outDir/$lang" - if (Test-Path $src) { - New-Item -ItemType Directory -Path "$stageRoot/$lang" -Force | Out-Null - Copy-Item "$src/*.dll" "$stageRoot/$lang/" - } - } - - Copy-Item "LuaScript/docs/LuaScript.*.txt" "$stageRoot/docs/" - Copy-Item ".github/LICENSE/*.txt" "$stageRoot/LICENSE/" - Copy-Item ".github/Plugin_Readme.txt" "$stageRoot/Readme.txt" - - Compress-Archive -Path "stage/*" -DestinationPath $pkgName -CompressionLevel Optimal - echo "PKG_NAME=$pkgName" >> $env:GITHUB_OUTPUT - - - name: Gitea リリースの作成 - shell: pwsh - env: - GITEA_TOKEN: ${{ github.token }} - REPOSITORY: ${{ github.repository }} - SERVER_URL: ${{ github.server_url }} - RELEASE_TAG: ${{ inputs.tag || github.ref_name }} - RELEASE_NAME: ${{ steps.version.outputs.TAG }} - RELEASE_BODY: '' - RELEASE_BODY_PATH: .github/CHANGELOG.md - RELEASE_DRAFT: false - RELEASE_PRERELEASE: false - RELEASE_FILES: | - ${{ steps.package.outputs.PKG_NAME }} - run: | - $headers = @{ Authorization = "token $env:GITEA_TOKEN" } - $api = "$env:SERVER_URL/api/v1/repos/$env:REPOSITORY" - $tag = $env:RELEASE_TAG - - $body = $env:RELEASE_BODY - if ($env:RELEASE_BODY_PATH -and (Test-Path $env:RELEASE_BODY_PATH)) { - $body = Get-Content $env:RELEASE_BODY_PATH -Raw -Encoding utf8 - } - - $files = @() - foreach ($pattern in ($env:RELEASE_FILES -split "[`r`n,]+" | Where-Object { $_.Trim() })) { - $found = @(Get-ChildItem -Path $pattern.Trim() -File -ErrorAction SilentlyContinue) - if ($found.Count -eq 0) { throw "リリースに付けるファイルが見つかりません: $pattern" } - $files += $found - } - - $payload = @{ - tag_name = $tag - name = $env:RELEASE_NAME - body = [string]$body - draft = ($env:RELEASE_DRAFT -eq 'true') - prerelease = ($env:RELEASE_PRERELEASE -eq 'true') - } | ConvertTo-Json - $bytes = [System.Text.Encoding]::UTF8.GetBytes($payload) - - $existing = $null - try { $existing = Invoke-RestMethod -Uri "$api/releases/tags/$([System.Uri]::EscapeDataString($tag))" -Headers $headers } catch { } - if ($existing) { - $release = Invoke-RestMethod -Method Patch -Uri "$api/releases/$($existing.id)" -Headers $headers -ContentType "application/json; charset=utf-8" -Body $bytes - foreach ($asset in @($existing.assets)) { - Invoke-RestMethod -Method Delete -Uri "$api/releases/$($existing.id)/assets/$($asset.id)" -Headers $headers | Out-Null - } - } else { - $release = Invoke-RestMethod -Method Post -Uri "$api/releases" -Headers $headers -ContentType "application/json; charset=utf-8" -Body $bytes - } - foreach ($file in $files) { - $name = [System.Uri]::EscapeDataString($file.Name) - Invoke-RestMethod -Method Post -Uri "$api/releases/$($release.id)/assets?name=$name" -Headers $headers -Form @{ attachment = Get-Item $file.FullName } | Out-Null - Write-Host "添付しました: $($file.Name)" - } - Write-Host "リリースを作成しました: $($release.html_url)" - diff --git a/.gitea/workflows/release-d15e5fdb.yml b/.gitea/workflows/release-d15e5fdb.yml deleted file mode 100644 index e3c05fe..0000000 --- a/.gitea/workflows/release-d15e5fdb.yml +++ /dev/null @@ -1,177 +0,0 @@ -name: リリース - -on: - push: - tags: - - 'v*' - workflow_dispatch: - inputs: - tag: - description: リリースするタグ - required: true - -permissions: - contents: write - -jobs: - build-and-release: - runs-on: windows-latest - - steps: - - name: ソースコードのチェックアウト - uses: actions/checkout@v4 - env: - 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://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 - - - name: YMM4 最新リリースの取得と解凍 - id: ymm4 - shell: pwsh - run: | - $release = Invoke-RestMethod -Uri "https://api.github.com/repos/manju-summoner/YukkuriMovieMaker4/releases/latest" ` - -Headers @{ "User-Agent" = "LuaScript-CI" } - $asset = $release.assets | Where-Object { $_.name -like "*_Lite.zip" } | Select-Object -First 1 - if (-not $asset) { - $asset = $release.assets | Where-Object { $_.name -like "*.zip" } | Select-Object -First 1 - } - Write-Host "ダウンロード対象: $($asset.name)" - $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 - - - name: タグ名からバージョンを取得 - id: version - shell: pwsh - run: | - $tag = "${{ inputs.tag || github.ref_name }}" - echo "TAG=$tag" >> $env:GITHUB_OUTPUT - echo "VERSION=$($tag.TrimStart('v'))" >> $env:GITHUB_OUTPUT - - - name: プロジェクトのビルド - shell: pwsh - env: - CI: 'true' - run: | - dotnet build LuaScript/LuaScript.csproj ` - -c Release ` - -p:YMM4DirPath="${{ steps.ymm4.outputs.YMM4_DIR }}" ` - -p:Platform=x64 - - - name: パッケージの作成 - id: package - shell: pwsh - run: | - $version = "${{ steps.version.outputs.TAG }}" - $outDir = "LuaScript/bin/x64/Release/net10.0-windows10.0.19041.0" - $stageRoot = "stage/LuaScript" - $pkgName = "LuaScript_$version.ymme" - - New-Item -ItemType Directory -Path "$stageRoot/docs" -Force | Out-Null - New-Item -ItemType Directory -Path "$stageRoot/native" -Force | Out-Null - New-Item -ItemType Directory -Path "$stageRoot/LICENSE" -Force | Out-Null - - Copy-Item "$outDir/LuaScript.dll" "$stageRoot/" - Copy-Item "$outDir/MoonSharp.Interpreter.dll" "$stageRoot/" - Copy-Item "$outDir/native/luajit.exe" "$stageRoot/native/" - Copy-Item "$outDir/native/lua51.dll" "$stageRoot/native/" - Copy-Item "$outDir/native/worker.lua" "$stageRoot/native/" - Copy-Item "$outDir/native/shim.lua" "$stageRoot/native/" - - foreach ($lang in @("ar-sa", "en-us", "es-es", "id-id", "ko-kr", "zh-cn", "zh-tw")) { - $src = "$outDir/$lang" - if (Test-Path $src) { - New-Item -ItemType Directory -Path "$stageRoot/$lang" -Force | Out-Null - Copy-Item "$src/*.dll" "$stageRoot/$lang/" - } - } - - Copy-Item "LuaScript/docs/LuaScript.*.txt" "$stageRoot/docs/" - Copy-Item ".github/LICENSE/*.txt" "$stageRoot/LICENSE/" - Copy-Item ".github/Plugin_Readme.txt" "$stageRoot/Readme.txt" - - Compress-Archive -Path "stage/*" -DestinationPath $pkgName -CompressionLevel Optimal - echo "PKG_NAME=$pkgName" >> $env:GITHUB_OUTPUT - - - name: Gitea リリースの作成 - shell: pwsh - env: - GITEA_TOKEN: ${{ github.token }} - REPOSITORY: ${{ github.repository }} - SERVER_URL: ${{ github.server_url }} - RELEASE_TAG: ${{ inputs.tag || github.ref_name }} - RELEASE_NAME: ${{ steps.version.outputs.TAG }} - RELEASE_BODY: '' - RELEASE_BODY_PATH: .github/CHANGELOG.md - RELEASE_DRAFT: false - RELEASE_PRERELEASE: false - RELEASE_FILES: | - ${{ steps.package.outputs.PKG_NAME }} - run: | - $headers = @{ Authorization = "token $env:GITEA_TOKEN" } - $api = "$env:SERVER_URL/api/v1/repos/$env:REPOSITORY" - $tag = $env:RELEASE_TAG - - $body = $env:RELEASE_BODY - if ($env:RELEASE_BODY_PATH -and (Test-Path $env:RELEASE_BODY_PATH)) { - $body = Get-Content $env:RELEASE_BODY_PATH -Raw -Encoding utf8 - } - - $files = @() - foreach ($pattern in ($env:RELEASE_FILES -split "[`r`n,]+" | Where-Object { $_.Trim() })) { - $found = @(Get-ChildItem -Path $pattern.Trim() -File -ErrorAction SilentlyContinue) - if ($found.Count -eq 0) { throw "リリースに付けるファイルが見つかりません: $pattern" } - $files += $found - } - - $payload = @{ - tag_name = $tag - name = $env:RELEASE_NAME - body = [string]$body - draft = ($env:RELEASE_DRAFT -eq 'true') - prerelease = ($env:RELEASE_PRERELEASE -eq 'true') - } | ConvertTo-Json - $bytes = [System.Text.Encoding]::UTF8.GetBytes($payload) - - $existing = $null - try { $existing = Invoke-RestMethod -Uri "$api/releases/tags/$([System.Uri]::EscapeDataString($tag))" -Headers $headers } catch { } - if ($existing) { - $release = Invoke-RestMethod -Method Patch -Uri "$api/releases/$($existing.id)" -Headers $headers -ContentType "application/json; charset=utf-8" -Body $bytes - foreach ($asset in @($existing.assets)) { - Invoke-RestMethod -Method Delete -Uri "$api/releases/$($existing.id)/assets/$($asset.id)" -Headers $headers | Out-Null - } - } else { - $release = Invoke-RestMethod -Method Post -Uri "$api/releases" -Headers $headers -ContentType "application/json; charset=utf-8" -Body $bytes - } - foreach ($file in $files) { - $name = [System.Uri]::EscapeDataString($file.Name) - Invoke-RestMethod -Method Post -Uri "$api/releases/$($release.id)/assets?name=$name" -Headers $headers -Form @{ attachment = Get-Item $file.FullName } | Out-Null - Write-Host "添付しました: $($file.Name)" - } - Write-Host "リリースを作成しました: $($release.html_url)" - diff --git a/.gitea/workflows/release-d9f7eaba.yml b/.gitea/workflows/release-d9f7eaba.yml deleted file mode 100644 index 5948857..0000000 --- a/.gitea/workflows/release-d9f7eaba.yml +++ /dev/null @@ -1,170 +0,0 @@ -name: リリース - -on: - push: - tags: - - 'v*' - workflow_dispatch: - inputs: - tag: - description: リリースするタグ - required: true - -permissions: - contents: write - -jobs: - build-and-release: - runs-on: windows-latest - - steps: - - name: ソースコードのチェックアウト - uses: actions/checkout@v4 - env: - 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://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 - - - name: YMM4 最新リリースの取得と解凍 - id: ymm4 - shell: pwsh - run: | - $release = Invoke-RestMethod -Uri "https://api.github.com/repos/manju-summoner/YukkuriMovieMaker4/releases/latest" ` - -Headers @{ "User-Agent" = "LuaScript-CI" } - $asset = $release.assets | Where-Object { $_.name -like "*_Lite.zip" } | Select-Object -First 1 - if (-not $asset) { - $asset = $release.assets | Where-Object { $_.name -like "*.zip" } | Select-Object -First 1 - } - Write-Host "ダウンロード対象: $($asset.name)" - $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 - - - name: タグ名からバージョンを取得 - id: version - shell: pwsh - run: | - $tag = "${{ inputs.tag || github.ref_name }}" - echo "TAG=$tag" >> $env:GITHUB_OUTPUT - echo "VERSION=$($tag.TrimStart('v'))" >> $env:GITHUB_OUTPUT - - - name: プロジェクトのビルド - shell: pwsh - env: - CI: 'true' - run: | - dotnet build LuaScript/LuaScript.csproj ` - -c Release ` - -p:YMM4DirPath="${{ steps.ymm4.outputs.YMM4_DIR }}" ` - -p:Platform=x64 - - - name: パッケージの作成 - id: package - shell: pwsh - run: | - $version = "${{ steps.version.outputs.TAG }}" - $outDir = "LuaScript/bin/x64/Release/net10.0-windows10.0.19041.0" - $stageRoot = "stage/LuaScript" - $pkgName = "LuaScript_$version.ymme" - - New-Item -ItemType Directory -Path "$stageRoot/docs" -Force | Out-Null - - Copy-Item "$outDir/LuaScript.dll" "$stageRoot/" - Copy-Item "$outDir/MoonSharp.Interpreter.dll" "$stageRoot/" - - foreach ($lang in @("ar-sa", "en-us", "es-es", "id-id", "ko-kr", "zh-cn", "zh-tw")) { - $src = "$outDir/$lang" - if (Test-Path $src) { - New-Item -ItemType Directory -Path "$stageRoot/$lang" -Force | Out-Null - Copy-Item "$src/*.dll" "$stageRoot/$lang/" - } - } - - Copy-Item "LuaScript/docs/LuaScript.*.txt" "$stageRoot/docs/" - Copy-Item ".github/Plugin_Readme.txt" "$stageRoot/Readme.txt" - - Compress-Archive -Path "stage/*" -DestinationPath $pkgName -CompressionLevel Optimal - echo "PKG_NAME=$pkgName" >> $env:GITHUB_OUTPUT - - - name: Gitea リリースの作成 - shell: pwsh - env: - GITEA_TOKEN: ${{ github.token }} - REPOSITORY: ${{ github.repository }} - SERVER_URL: ${{ github.server_url }} - RELEASE_TAG: ${{ inputs.tag || github.ref_name }} - RELEASE_NAME: ${{ steps.version.outputs.TAG }} - RELEASE_BODY: '' - RELEASE_BODY_PATH: .github/CHANGELOG.md - RELEASE_DRAFT: false - RELEASE_PRERELEASE: false - RELEASE_FILES: | - ${{ steps.package.outputs.PKG_NAME }} - run: | - $headers = @{ Authorization = "token $env:GITEA_TOKEN" } - $api = "$env:SERVER_URL/api/v1/repos/$env:REPOSITORY" - $tag = $env:RELEASE_TAG - - $body = $env:RELEASE_BODY - if ($env:RELEASE_BODY_PATH -and (Test-Path $env:RELEASE_BODY_PATH)) { - $body = Get-Content $env:RELEASE_BODY_PATH -Raw -Encoding utf8 - } - - $files = @() - foreach ($pattern in ($env:RELEASE_FILES -split "[`r`n,]+" | Where-Object { $_.Trim() })) { - $found = @(Get-ChildItem -Path $pattern.Trim() -File -ErrorAction SilentlyContinue) - if ($found.Count -eq 0) { throw "リリースに付けるファイルが見つかりません: $pattern" } - $files += $found - } - - $payload = @{ - tag_name = $tag - name = $env:RELEASE_NAME - body = [string]$body - draft = ($env:RELEASE_DRAFT -eq 'true') - prerelease = ($env:RELEASE_PRERELEASE -eq 'true') - } | ConvertTo-Json - $bytes = [System.Text.Encoding]::UTF8.GetBytes($payload) - - $existing = $null - try { $existing = Invoke-RestMethod -Uri "$api/releases/tags/$([System.Uri]::EscapeDataString($tag))" -Headers $headers } catch { } - if ($existing) { - $release = Invoke-RestMethod -Method Patch -Uri "$api/releases/$($existing.id)" -Headers $headers -ContentType "application/json; charset=utf-8" -Body $bytes - foreach ($asset in @($existing.assets)) { - Invoke-RestMethod -Method Delete -Uri "$api/releases/$($existing.id)/assets/$($asset.id)" -Headers $headers | Out-Null - } - } else { - $release = Invoke-RestMethod -Method Post -Uri "$api/releases" -Headers $headers -ContentType "application/json; charset=utf-8" -Body $bytes - } - foreach ($file in $files) { - $name = [System.Uri]::EscapeDataString($file.Name) - Invoke-RestMethod -Method Post -Uri "$api/releases/$($release.id)/assets?name=$name" -Headers $headers -Form @{ attachment = Get-Item $file.FullName } | Out-Null - Write-Host "添付しました: $($file.Name)" - } - Write-Host "リリースを作成しました: $($release.html_url)" - diff --git a/.gitea/workflows/release-e533970d.yml b/.gitea/workflows/release-e533970d.yml deleted file mode 100644 index 4835eaf..0000000 --- a/.gitea/workflows/release-e533970d.yml +++ /dev/null @@ -1,186 +0,0 @@ -name: リリース - -on: - push: - tags: - - 'v*' - workflow_dispatch: - inputs: - tag: - description: リリースするタグ - required: true - -permissions: - contents: write - -jobs: - build-and-release: - runs-on: windows-latest - - steps: - - name: ソースコードのチェックアウト - uses: actions/checkout@v4 - env: - 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://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 - - - name: YMM4 最新リリースの取得と解凍 - id: ymm4 - shell: pwsh - run: | - $latest = 'C:\runner\cache\ymm4\latest.json' - New-Item -ItemType Directory -Force -Path (Split-Path $latest) | Out-Null - if (-not (Test-Path $latest) -or ((Get-Date) - (Get-Item $latest).LastWriteTime).TotalHours -gt 6) { - try { - Invoke-RestMethod -Uri "https://api.github.com/repos/manju-summoner/YukkuriMovieMaker4/releases/latest" ` - -Headers @{ "User-Agent" = "LuaScript-CI" } -ErrorAction Stop | ConvertTo-Json -Depth 20 | Set-Content -Path $latest -Encoding UTF8 - } - catch { - if (-not (Test-Path $latest)) { throw } - Write-Host "最新版の問い合わせに失敗したため、保存済みの情報を使います: $($_.Exception.Message)" - } - } - $release = Get-Content -Raw -Path $latest | ConvertFrom-Json - $asset = $release.assets | Where-Object { $_.name -like "*_Lite.zip" } | Select-Object -First 1 - if (-not $asset) { - $asset = $release.assets | Where-Object { $_.name -like "*.zip" } | Select-Object -First 1 - } - Write-Host "ダウンロード対象: $($asset.name)" - $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 - - - name: タグ名からバージョンを取得 - id: version - shell: pwsh - run: | - $tag = "${{ inputs.tag || github.ref_name }}" - echo "TAG=$tag" >> $env:GITHUB_OUTPUT - echo "VERSION=$($tag.TrimStart('v'))" >> $env:GITHUB_OUTPUT - - - name: プロジェクトのビルド - shell: pwsh - env: - CI: 'true' - run: | - dotnet build LuaScript/LuaScript.csproj ` - -c Release ` - -p:YMM4DirPath="${{ steps.ymm4.outputs.YMM4_DIR }}" ` - -p:Platform=x64 - - - name: パッケージの作成 - id: package - shell: pwsh - run: | - $version = "${{ steps.version.outputs.TAG }}" - $outDir = "LuaScript/bin/x64/Release/net10.0-windows10.0.19041.0" - $stageRoot = "stage/LuaScript" - $pkgName = "LuaScript_$version.ymme" - - New-Item -ItemType Directory -Path "$stageRoot/docs" -Force | Out-Null - New-Item -ItemType Directory -Path "$stageRoot/native" -Force | Out-Null - - Copy-Item "$outDir/LuaScript.dll" "$stageRoot/" - Copy-Item "$outDir/MoonSharp.Interpreter.dll" "$stageRoot/" - Copy-Item "$outDir/native/luajit.exe" "$stageRoot/native/" - Copy-Item "$outDir/native/lua51.dll" "$stageRoot/native/" - Copy-Item "$outDir/native/worker.lua" "$stageRoot/native/" - Copy-Item "$outDir/native/shim.lua" "$stageRoot/native/" - - foreach ($lang in @("ar-sa", "en-us", "es-es", "id-id", "ko-kr", "zh-cn", "zh-tw")) { - $src = "$outDir/$lang" - if (Test-Path $src) { - New-Item -ItemType Directory -Path "$stageRoot/$lang" -Force | Out-Null - Copy-Item "$src/*.dll" "$stageRoot/$lang/" - } - } - - Copy-Item "LuaScript/docs/LuaScript.*.txt" "$stageRoot/docs/" - Copy-Item ".github/Plugin_Readme.txt" "$stageRoot/Readme.txt" - - Compress-Archive -Path "stage/*" -DestinationPath $pkgName -CompressionLevel Optimal - echo "PKG_NAME=$pkgName" >> $env:GITHUB_OUTPUT - - - name: Gitea リリースの作成 - shell: pwsh - env: - GITEA_TOKEN: ${{ github.token }} - REPOSITORY: ${{ github.repository }} - SERVER_URL: ${{ github.server_url }} - RELEASE_TAG: ${{ inputs.tag || github.ref_name }} - RELEASE_NAME: ${{ steps.version.outputs.TAG }} - RELEASE_BODY: '' - RELEASE_BODY_PATH: .github/CHANGELOG.md - RELEASE_DRAFT: false - RELEASE_PRERELEASE: false - RELEASE_FILES: | - ${{ steps.package.outputs.PKG_NAME }} - run: | - $headers = @{ Authorization = "token $env:GITEA_TOKEN" } - $api = "$env:SERVER_URL/api/v1/repos/$env:REPOSITORY" - $tag = $env:RELEASE_TAG - - $body = $env:RELEASE_BODY - if ($env:RELEASE_BODY_PATH -and (Test-Path $env:RELEASE_BODY_PATH)) { - $body = Get-Content $env:RELEASE_BODY_PATH -Raw -Encoding utf8 - } - - $files = @() - foreach ($pattern in ($env:RELEASE_FILES -split "[`r`n,]+" | Where-Object { $_.Trim() })) { - $found = @(Get-ChildItem -Path $pattern.Trim() -File -ErrorAction SilentlyContinue) - if ($found.Count -eq 0) { throw "リリースに付けるファイルが見つかりません: $pattern" } - $files += $found - } - - $payload = @{ - tag_name = $tag - name = $env:RELEASE_NAME - body = [string]$body - draft = ($env:RELEASE_DRAFT -eq 'true') - prerelease = ($env:RELEASE_PRERELEASE -eq 'true') - } | ConvertTo-Json - $bytes = [System.Text.Encoding]::UTF8.GetBytes($payload) - - $existing = $null - try { $existing = Invoke-RestMethod -Uri "$api/releases/tags/$([System.Uri]::EscapeDataString($tag))" -Headers $headers } catch { } - if ($existing) { - $release = Invoke-RestMethod -Method Patch -Uri "$api/releases/$($existing.id)" -Headers $headers -ContentType "application/json; charset=utf-8" -Body $bytes - foreach ($asset in @($existing.assets)) { - Invoke-RestMethod -Method Delete -Uri "$api/releases/$($existing.id)/assets/$($asset.id)" -Headers $headers | Out-Null - } - } else { - $release = Invoke-RestMethod -Method Post -Uri "$api/releases" -Headers $headers -ContentType "application/json; charset=utf-8" -Body $bytes - } - foreach ($file in $files) { - $name = [System.Uri]::EscapeDataString($file.Name) - Invoke-RestMethod -Method Post -Uri "$api/releases/$($release.id)/assets?name=$name" -Headers $headers -Form @{ attachment = Get-Item $file.FullName } | Out-Null - Write-Host "添付しました: $($file.Name)" - } - Write-Host "リリースを作成しました: $($release.html_url)" - diff --git a/.gitea/workflows/release-fd53c061.yml b/.gitea/workflows/release-fd53c061.yml deleted file mode 100644 index 4aba53a..0000000 --- a/.gitea/workflows/release-fd53c061.yml +++ /dev/null @@ -1,188 +0,0 @@ -name: リリース - -on: - push: - tags: - - 'v*' - workflow_dispatch: - inputs: - tag: - description: リリースするタグ - required: true - -permissions: - contents: write - -jobs: - build-and-release: - runs-on: windows-latest - - steps: - - name: ソースコードのチェックアウト - uses: actions/checkout@v4 - env: - 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://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 - - - name: YMM4 最新リリースの取得と解凍 - id: ymm4 - shell: pwsh - run: | - $latest = 'C:\runner\cache\ymm4\latest.json' - New-Item -ItemType Directory -Force -Path (Split-Path $latest) | Out-Null - if (-not (Test-Path $latest) -or ((Get-Date) - (Get-Item $latest).LastWriteTime).TotalHours -gt 6) { - try { - Invoke-RestMethod -Uri "https://api.github.com/repos/manju-summoner/YukkuriMovieMaker4/releases/latest" ` - -Headers @{ "User-Agent" = "LuaScript-CI" } -ErrorAction Stop | ConvertTo-Json -Depth 20 | Set-Content -Path $latest -Encoding UTF8 - } - catch { - if (-not (Test-Path $latest)) { throw } - Write-Host "最新版の問い合わせに失敗したため、保存済みの情報を使います: $($_.Exception.Message)" - } - } - $release = Get-Content -Raw -Path $latest | ConvertFrom-Json - $asset = $release.assets | Where-Object { $_.name -like "*_Lite.zip" } | Select-Object -First 1 - if (-not $asset) { - $asset = $release.assets | Where-Object { $_.name -like "*.zip" } | Select-Object -First 1 - } - Write-Host "ダウンロード対象: $($asset.name)" - $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 - - - name: タグ名からバージョンを取得 - id: version - shell: pwsh - run: | - $tag = "${{ inputs.tag || github.ref_name }}" - echo "TAG=$tag" >> $env:GITHUB_OUTPUT - echo "VERSION=$($tag.TrimStart('v'))" >> $env:GITHUB_OUTPUT - - - name: プロジェクトのビルド - shell: pwsh - env: - CI: 'true' - run: | - dotnet build LuaScript/LuaScript.csproj ` - -c Release ` - -p:YMM4DirPath="${{ steps.ymm4.outputs.YMM4_DIR }}" ` - -p:Platform=x64 - - - name: パッケージの作成 - id: package - shell: pwsh - run: | - $version = "${{ steps.version.outputs.TAG }}" - $outDir = "LuaScript/bin/x64/Release/net10.0-windows10.0.19041.0" - $stageRoot = "stage/LuaScript" - $pkgName = "LuaScript_$version.ymme" - - New-Item -ItemType Directory -Path "$stageRoot/docs" -Force | Out-Null - New-Item -ItemType Directory -Path "$stageRoot/native" -Force | Out-Null - New-Item -ItemType Directory -Path "$stageRoot/LICENSE" -Force | Out-Null - - Copy-Item "$outDir/LuaScript.dll" "$stageRoot/" - Copy-Item "$outDir/MoonSharp.Interpreter.dll" "$stageRoot/" - Copy-Item "$outDir/native/luajit.exe" "$stageRoot/native/" - Copy-Item "$outDir/native/lua51.dll" "$stageRoot/native/" - Copy-Item "$outDir/native/worker.lua" "$stageRoot/native/" - Copy-Item "$outDir/native/shim.lua" "$stageRoot/native/" - - foreach ($lang in @("ar-sa", "en-us", "es-es", "id-id", "ko-kr", "zh-cn", "zh-tw")) { - $src = "$outDir/$lang" - if (Test-Path $src) { - New-Item -ItemType Directory -Path "$stageRoot/$lang" -Force | Out-Null - Copy-Item "$src/*.dll" "$stageRoot/$lang/" - } - } - - Copy-Item "LuaScript/docs/LuaScript.*.txt" "$stageRoot/docs/" - Copy-Item ".github/LICENSE/*.txt" "$stageRoot/LICENSE/" - Copy-Item ".github/Plugin_Readme.txt" "$stageRoot/Readme.txt" - - Compress-Archive -Path "stage/*" -DestinationPath $pkgName -CompressionLevel Optimal - echo "PKG_NAME=$pkgName" >> $env:GITHUB_OUTPUT - - - name: Gitea リリースの作成 - shell: pwsh - env: - GITEA_TOKEN: ${{ github.token }} - REPOSITORY: ${{ github.repository }} - SERVER_URL: ${{ github.server_url }} - RELEASE_TAG: ${{ inputs.tag || github.ref_name }} - RELEASE_NAME: ${{ steps.version.outputs.TAG }} - RELEASE_BODY: '' - RELEASE_BODY_PATH: .github/CHANGELOG.md - RELEASE_DRAFT: false - RELEASE_PRERELEASE: false - RELEASE_FILES: | - ${{ steps.package.outputs.PKG_NAME }} - run: | - $headers = @{ Authorization = "token $env:GITEA_TOKEN" } - $api = "$env:SERVER_URL/api/v1/repos/$env:REPOSITORY" - $tag = $env:RELEASE_TAG - - $body = $env:RELEASE_BODY - if ($env:RELEASE_BODY_PATH -and (Test-Path $env:RELEASE_BODY_PATH)) { - $body = Get-Content $env:RELEASE_BODY_PATH -Raw -Encoding utf8 - } - - $files = @() - foreach ($pattern in ($env:RELEASE_FILES -split "[`r`n,]+" | Where-Object { $_.Trim() })) { - $found = @(Get-ChildItem -Path $pattern.Trim() -File -ErrorAction SilentlyContinue) - if ($found.Count -eq 0) { throw "リリースに付けるファイルが見つかりません: $pattern" } - $files += $found - } - - $payload = @{ - tag_name = $tag - name = $env:RELEASE_NAME - body = [string]$body - draft = ($env:RELEASE_DRAFT -eq 'true') - prerelease = ($env:RELEASE_PRERELEASE -eq 'true') - } | ConvertTo-Json - $bytes = [System.Text.Encoding]::UTF8.GetBytes($payload) - - $existing = $null - try { $existing = Invoke-RestMethod -Uri "$api/releases/tags/$([System.Uri]::EscapeDataString($tag))" -Headers $headers } catch { } - if ($existing) { - $release = Invoke-RestMethod -Method Patch -Uri "$api/releases/$($existing.id)" -Headers $headers -ContentType "application/json; charset=utf-8" -Body $bytes - foreach ($asset in @($existing.assets)) { - Invoke-RestMethod -Method Delete -Uri "$api/releases/$($existing.id)/assets/$($asset.id)" -Headers $headers | Out-Null - } - } else { - $release = Invoke-RestMethod -Method Post -Uri "$api/releases" -Headers $headers -ContentType "application/json; charset=utf-8" -Body $bytes - } - foreach ($file in $files) { - $name = [System.Uri]::EscapeDataString($file.Name) - Invoke-RestMethod -Method Post -Uri "$api/releases/$($release.id)/assets?name=$name" -Headers $headers -Form @{ attachment = Get-Item $file.FullName } | Out-Null - Write-Host "添付しました: $($file.Name)" - } - Write-Host "リリースを作成しました: $($release.html_url)" -