516 行
21 KiB
YAML
516 行
21 KiB
YAML
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@v7
|
|
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
|
|
fetch-depth: 0
|
|
|
|
- name: 新しい解析規則を警告のままにする
|
|
shell: pwsh
|
|
run: |
|
|
if (Test-Path ComputeSharp) {
|
|
$directories = Get-ChildItem -Path . -Recurse -Depth 2 -Include *.csproj,*.vcxproj,*.sln,*.slnx -File |
|
|
Where-Object { $_.FullName -notmatch '[\\/](ComputeSharp|YukkuriMovieMaker\.Generator)[\\/]' } |
|
|
ForEach-Object { $_.DirectoryName } | Sort-Object -Unique
|
|
foreach ($directory in $directories) {
|
|
Set-Content -Path (Join-Path $directory 'Directory.Build.rsp') -Value '-p:WarningsNotAsErrors=IDE0410'
|
|
}
|
|
}
|
|
|
|
- name: MSBuild のセットアップ
|
|
uses: microsoft/setup-msbuild@v3
|
|
|
|
- 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" = "InkDispersion-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
|
|
run: |
|
|
$tag = "${{ steps.version.outputs.TAG }}"
|
|
$version = "${{ steps.version.outputs.VERSION }}"
|
|
$problems = @()
|
|
|
|
$csprojPath = "InkDispersion/InkDispersion.csproj"
|
|
$csproj = Get-Content $csprojPath -Raw
|
|
if (-not $csproj.Contains("<Version>$version</Version>")) {
|
|
$current = if ($csproj -match '<Version>([^<]*)</Version>') { $Matches[1] } else { "記載なし" }
|
|
$problems += "$csprojPath の <Version> が $current です。$version にしてください。"
|
|
}
|
|
|
|
$readmePath = ".github/Plugin_Readme.txt"
|
|
$readme = Get-Content $readmePath -Raw
|
|
if (-not $readme.Contains(" 墨拡散 for YMM4 $tag")) {
|
|
$current = if ($readme -match '(?m)^ 墨拡散 for YMM4 (\S+)') { $Matches[1] } else { "記載なし" }
|
|
$problems += "$readmePath の見出しが $current です。$tag にしてください。"
|
|
}
|
|
|
|
if ($problems.Count -eq 0) {
|
|
Write-Host "バージョン記載は $tag と一致しています"
|
|
exit 0
|
|
}
|
|
|
|
foreach ($problem in $problems) {
|
|
Write-Host "::error::$problem"
|
|
}
|
|
Write-Host "::error::リリースの対象は $tag が指すコミットです。タグを付けた後で main へ訂正を積んでも、その訂正はリリースに入りません。タグを削除し、記載を直したコミットを積んでから付け直してください。"
|
|
exit 1
|
|
|
|
- name: シェーダーのビルド
|
|
shell: pwsh
|
|
run: |
|
|
msbuild InkDispersion.Shader/InkDispersion.Shader.vcxproj `
|
|
/p:Configuration=Release `
|
|
/p:Platform=Win32 `
|
|
/nologo
|
|
|
|
- name: プロジェクトのビルド
|
|
shell: pwsh
|
|
run: |
|
|
$proj = "InkDispersion/InkDispersion.csproj"
|
|
dotnet build "$proj" `
|
|
-c Release `
|
|
-p:YMM4DirPath="${{ steps.ymm4.outputs.YMM4_DIR }}" `
|
|
-p:Platform=x64 `
|
|
-p:SkipPluginDeploy=true
|
|
|
|
- name: テストプロジェクトのビルド
|
|
shell: pwsh
|
|
run: |
|
|
dotnet build InkDispersion.Tests/InkDispersion.Tests.csproj `
|
|
-c Release `
|
|
-p:YMM4DirPath="${{ steps.ymm4.outputs.YMM4_DIR }}" `
|
|
-p:Platform=x64 `
|
|
-p:SkipPluginDeploy=true `
|
|
-maxcpucount:1
|
|
|
|
- name: テストの実行
|
|
shell: pwsh
|
|
run: |
|
|
dotnet test InkDispersion.Tests/InkDispersion.Tests.csproj `
|
|
--no-build `
|
|
--no-restore `
|
|
-c Release `
|
|
-p:Platform=x64 `
|
|
-p:SkipPluginDeploy=true
|
|
|
|
- name: パッケージの作成
|
|
id: package
|
|
shell: pwsh
|
|
run: |
|
|
$version = "${{ steps.version.outputs.TAG }}"
|
|
$outDir = "InkDispersion/bin/x64/Release/net10.0-windows10.0.19041.0"
|
|
$stageRoot = "stage/InkDispersion"
|
|
$pkgName = "InkDispersion_$version.ymme"
|
|
|
|
New-Item -ItemType Directory -Path $stageRoot -Force | Out-Null
|
|
New-Item -ItemType Directory -Path "$stageRoot/LICENSE" -Force | Out-Null
|
|
|
|
$dll = "$outDir/plugin/InkDispersion.dll"
|
|
if (-not (Test-Path $dll)) {
|
|
Write-Error "ビルド結果に InkDispersion.dll が見つかりませんでした: $dll"
|
|
exit 1
|
|
}
|
|
Copy-Item $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 ".github/LICENSE/*.txt" "$stageRoot/LICENSE/"
|
|
Copy-Item ".github/Plugin_Readme.txt" "$stageRoot/Readme.txt"
|
|
|
|
$readme = Get-Content "$stageRoot/Readme.txt" -Raw
|
|
if (-not $readme.Contains(" 墨拡散 for YMM4 $version")) {
|
|
Write-Error "同梱する Readme.txt の見出しが $version と一致しません"
|
|
exit 1
|
|
}
|
|
|
|
Compress-Archive -Path "stage/*" -DestinationPath $pkgName -CompressionLevel Optimal
|
|
echo "PKG_NAME=$pkgName" >> $env:GITHUB_OUTPUT
|
|
|
|
- name: 変更履歴の作成
|
|
id: changelog
|
|
shell: pwsh
|
|
env:
|
|
GITEA_TOKEN: ${{ github.token }}
|
|
TAG: ${{ steps.version.outputs.TAG }}
|
|
REPOSITORY: ${{ github.repository }}
|
|
SERVER_URL: ${{ github.server_url }}
|
|
PACKAGE: ${{ steps.package.outputs.PKG_NAME }}
|
|
run: |
|
|
$tag = $env:TAG
|
|
$repository = $env:REPOSITORY
|
|
$server = $env:SERVER_URL
|
|
$code = [char]0x60
|
|
$fence = [string]::new($code, 3)
|
|
$unit = [char]0x1f
|
|
$record = [char]0x1e
|
|
|
|
$previous = ""
|
|
$candidates = @(git tag --list "v*" --merged $tag --sort=-creatordate | Where-Object { $_ -ne $tag })
|
|
if ($candidates.Count -gt 0) {
|
|
$previous = $candidates[0]
|
|
}
|
|
Write-Host "直前のタグ: $previous"
|
|
|
|
$range = if ($previous) { "$previous..$tag" } else { $tag }
|
|
$log = (@(git log "--format=%H%x1f%s%x1f%an%x1f%ad%x1f%b%x1e" --date=short $range) -join "`n") -split $record
|
|
|
|
$commits = @()
|
|
foreach ($entry in $log) {
|
|
if (-not $entry.Trim()) { continue }
|
|
$fields = $entry.TrimStart("`n") -split $unit
|
|
if ($fields.Count -lt 5) { continue }
|
|
$commits += [pscustomobject]@{
|
|
Sha = $fields[0]
|
|
Subject = $fields[1]
|
|
Name = $fields[2]
|
|
Date = $fields[3]
|
|
Body = $fields[4]
|
|
Login = ""
|
|
Avatar = ""
|
|
}
|
|
}
|
|
Write-Host "コミット数: $($commits.Count)"
|
|
|
|
$categories = [ordered]@{
|
|
A = @{ Title = "追加"; Symbol = "+"; Items = [System.Collections.Generic.List[pscustomobject]]::new() }
|
|
M = @{ Title = "変更"; Symbol = "~"; Items = [System.Collections.Generic.List[pscustomobject]]::new() }
|
|
D = @{ Title = "削除"; Symbol = "-"; Items = [System.Collections.Generic.List[pscustomobject]]::new() }
|
|
F = @{ Title = "修正"; Symbol = "!"; Items = [System.Collections.Generic.List[pscustomobject]]::new() }
|
|
}
|
|
foreach ($commit in $commits) {
|
|
if (-not $commit.Body) { continue }
|
|
foreach ($bodyLine in ($commit.Body -split "`n")) {
|
|
$trimmed = $bodyLine.Trim()
|
|
if ($trimmed -notmatch '^・(.+)-([AMDF])$') { continue }
|
|
$categories[$Matches[2]].Items.Add([pscustomobject]@{ Text = $Matches[1]; Sha = $commit.Sha })
|
|
}
|
|
}
|
|
|
|
$pending = [System.Collections.Generic.HashSet[string]]::new()
|
|
foreach ($commit in $commits) {
|
|
[void]$pending.Add($commit.Sha)
|
|
}
|
|
|
|
$headers = @{ Authorization = "token $env:GITEA_TOKEN" }
|
|
|
|
$accounts = @{}
|
|
$page = 1
|
|
while ($pending.Count -gt 0 -and $page -le 20) {
|
|
$rows = @()
|
|
try {
|
|
$rows = @(Invoke-RestMethod -Uri "$server/api/v1/repos/$repository/commits?sha=$tag&limit=50&page=$page&stat=false&verification=false&files=false" -Headers $headers)
|
|
}
|
|
catch {
|
|
Write-Host "コミットの作者を取得できませんでした: $($_.Exception.Message)"
|
|
break
|
|
}
|
|
if ($rows.Count -eq 0) { break }
|
|
|
|
foreach ($row in $rows) {
|
|
if ($pending.Remove($row.sha)) {
|
|
$login = ""
|
|
$avatar = ""
|
|
if ($row.author) {
|
|
$login = [string]$row.author.login
|
|
$avatar = [string]$row.author.avatar_url
|
|
}
|
|
$accounts[$row.sha] = @{ Login = $login; Avatar = $avatar }
|
|
}
|
|
}
|
|
|
|
if ($rows.Count -lt 50) { break }
|
|
$page++
|
|
}
|
|
|
|
foreach ($commit in $commits) {
|
|
if ($accounts.ContainsKey($commit.Sha)) {
|
|
$commit.Login = $accounts[$commit.Sha].Login
|
|
$commit.Avatar = $accounts[$commit.Sha].Avatar
|
|
}
|
|
}
|
|
|
|
$emptyTree = "4b825dc642cb6eb9a060e54bf8d69288fbee4904"
|
|
$base = if ($previous) { $previous } else { $emptyTree }
|
|
$shortstat = (@(git diff --shortstat $base $tag) -join " ")
|
|
$changedFiles = 0
|
|
$insertions = 0
|
|
$deletions = 0
|
|
if ($shortstat -match "(\d+) file") { $changedFiles = [int]$Matches[1] }
|
|
if ($shortstat -match "(\d+) insertion") { $insertions = [int]$Matches[1] }
|
|
if ($shortstat -match "(\d+) deletion") { $deletions = [int]$Matches[1] }
|
|
$diffStat = @(git diff --stat $base $tag)
|
|
$tagDate = (git log -1 "--format=%ad" --date=short $tag)
|
|
|
|
$contributors = @($commits |
|
|
Group-Object -Property { if ($_.Login) { $_.Login } else { $_.Name } } |
|
|
Sort-Object -Property Count -Descending)
|
|
|
|
function Get-Icon($avatar, $login, $size) {
|
|
if (-not $avatar) { return "" }
|
|
$sized = if ($avatar.Contains("?")) { "$avatar&s=$($size * 2)" } else { "$avatar" + "?s=$($size * 2)" }
|
|
return "<img src=""$sized"" width=""$size"" height=""$size"" alt=""$login""> "
|
|
}
|
|
|
|
$package = Get-Item $env:PACKAGE
|
|
$size = [math]::Round($package.Length / 1MB, 2)
|
|
|
|
$body = [System.Collections.Generic.List[string]]::new()
|
|
$body.Add("## 概要")
|
|
$body.Add("")
|
|
$body.Add("| 項目 | 内容 |")
|
|
$body.Add("|---|---|")
|
|
$body.Add("| タグ | [$tag]($server/$repository/tree/$tag) |")
|
|
$body.Add("| 公開日 | $tagDate |")
|
|
if ($previous) {
|
|
$body.Add("| 直前のリリース | [$previous]($server/$repository/releases/tag/$previous) |")
|
|
}
|
|
$body.Add("| コミット数 | $($commits.Count) |")
|
|
$body.Add("| 貢献者 | $($contributors.Count) 名 |")
|
|
$body.Add("| 変更されたファイル | $changedFiles |")
|
|
$body.Add("| 追加された行 | $insertions |")
|
|
$body.Add("| 削除された行 | $deletions |")
|
|
|
|
$hasHighlights = ($categories.Values | ForEach-Object { $_.Items.Count } | Measure-Object -Sum).Sum -gt 0
|
|
if ($hasHighlights) {
|
|
$body.Add("")
|
|
$body.Add("## 主な変更")
|
|
foreach ($key in $categories.Keys) {
|
|
$category = $categories[$key]
|
|
if ($category.Items.Count -eq 0) { continue }
|
|
$body.Add("")
|
|
$body.Add("### [$($category.Symbol)] $($category.Title)")
|
|
$body.Add("")
|
|
foreach ($item in $category.Items) {
|
|
$short = $item.Sha.Substring(0, 7)
|
|
$body.Add("- $($item.Text) ([$code$short$code]($server/$repository/commit/$($item.Sha)))")
|
|
}
|
|
}
|
|
}
|
|
|
|
$body.Add("")
|
|
$body.Add("## ダウンロード")
|
|
$body.Add("")
|
|
$body.Add("| ファイル | サイズ |")
|
|
$body.Add("|---|---|")
|
|
$body.Add("| $($package.Name) | $size MB |")
|
|
|
|
$body.Add("")
|
|
$body.Add("## 貢献者")
|
|
$body.Add("")
|
|
$body.Add("| 貢献者 | コミット数 |")
|
|
$body.Add("|---|---|")
|
|
foreach ($contributor in $contributors) {
|
|
$first = $contributor.Group[0]
|
|
if ($first.Login) {
|
|
$name = (Get-Icon $first.Avatar $first.Login 40) + "[@$($first.Login)]($server/$($first.Login))"
|
|
}
|
|
else {
|
|
$name = $first.Name
|
|
}
|
|
$body.Add("| $name | $($contributor.Count) |")
|
|
}
|
|
|
|
$body.Add("")
|
|
$body.Add("## 変更履歴")
|
|
$body.Add("")
|
|
$body.Add("| コミット | 内容 | 貢献者 | 日付 |")
|
|
$body.Add("|---|---|---|---|")
|
|
$maximumCommits = 300
|
|
$listed = 0
|
|
foreach ($commit in $commits) {
|
|
if ($listed -ge $maximumCommits) { break }
|
|
$short = $commit.Sha.Substring(0, 7)
|
|
$subject = $commit.Subject -replace '\|', '\|'
|
|
if ($commit.Login) {
|
|
$author = (Get-Icon $commit.Avatar $commit.Login 20) + "[@$($commit.Login)]($server/$($commit.Login))"
|
|
}
|
|
else {
|
|
$author = $commit.Name
|
|
}
|
|
$body.Add("| [$code$short$code]($server/$repository/commit/$($commit.Sha)) | $subject | $author | $($commit.Date) |")
|
|
$listed++
|
|
}
|
|
if ($commits.Count -gt $maximumCommits) {
|
|
$body.Add("")
|
|
$body.Add("残り $($commits.Count - $maximumCommits) 件のコミットは省略しました。")
|
|
}
|
|
|
|
if ($diffStat.Count -gt 0) {
|
|
$body.Add("")
|
|
$body.Add("## 変更されたファイル")
|
|
$body.Add("")
|
|
$body.Add("<details>")
|
|
$body.Add("<summary>差分の統計</summary>")
|
|
$body.Add("")
|
|
$body.Add($fence)
|
|
$maximumStatLines = 200
|
|
$shown = 0
|
|
foreach ($line in $diffStat) {
|
|
if ($shown -ge $maximumStatLines) { break }
|
|
$body.Add($line)
|
|
$shown++
|
|
}
|
|
if ($diffStat.Count -gt $maximumStatLines) {
|
|
$body.Add("... 残り $($diffStat.Count - $maximumStatLines) 行は省略しました。")
|
|
}
|
|
$body.Add($fence)
|
|
$body.Add("")
|
|
$body.Add("</details>")
|
|
}
|
|
|
|
if ($previous) {
|
|
$body.Add("")
|
|
$body.Add("## 全ての変更")
|
|
$body.Add("")
|
|
$body.Add("$server/$repository/compare/$previous...$tag")
|
|
}
|
|
|
|
$path = "release-body.md"
|
|
Set-Content -Path $path -Value ($body -join "`n") -Encoding utf8NoBOM
|
|
if (-not (Test-Path $path)) {
|
|
throw "変更履歴を作成できませんでした。"
|
|
}
|
|
Write-Host "変更履歴の行数: $($body.Count)"
|
|
$global:LASTEXITCODE = 0
|
|
|
|
- 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: release-body.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)"
|
|
|