信捷PLCSkill
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。
 
 
 
 

60 行
1.6 KiB

  1. [CmdletBinding()]
  2. param(
  3. [switch]$NoPush
  4. )
  5. $ErrorActionPreference = 'Stop'
  6. $repositoryRoot = Split-Path -Parent $PSScriptRoot
  7. $skillFile = Join-Path $repositoryRoot 'SKILL.md'
  8. Set-Location -LiteralPath $repositoryRoot
  9. $pendingChanges = git status --porcelain
  10. if (-not $pendingChanges) {
  11. throw 'No skill changes are pending. Update the skill before creating a release.'
  12. }
  13. $content = Get-Content -LiteralPath $skillFile -Raw -Encoding UTF8
  14. $match = [regex]::Match($content, '(?m)^Version:\s*(?<version>\d+\.\d+\.\d+)\s*$')
  15. if (-not $match.Success) {
  16. throw "Could not find a 'Version: x.y.z' line in $skillFile."
  17. }
  18. $currentVersion = [version]$match.Groups['version'].Value
  19. $nextVersion = '{0}.{1}.0' -f $currentVersion.Major, ($currentVersion.Minor + 1)
  20. $updatedContent = [regex]::Replace(
  21. $content,
  22. '(?m)^Version:\s*\d+\.\d+\.\d+\s*$',
  23. "Version: $nextVersion",
  24. 1
  25. )
  26. Set-Content -LiteralPath $skillFile -Value $updatedContent -Encoding UTF8
  27. git add --all
  28. if ($LASTEXITCODE -ne 0) {
  29. throw 'git add failed.'
  30. }
  31. git diff --cached --quiet
  32. if ($LASTEXITCODE -eq 0) {
  33. throw 'No staged changes found after version update.'
  34. }
  35. if ($LASTEXITCODE -ne 1) {
  36. throw 'Could not inspect the staged Git diff.'
  37. }
  38. git commit -m "release: xinje-plc-programming v$nextVersion"
  39. if ($LASTEXITCODE -ne 0) {
  40. throw 'git commit failed.'
  41. }
  42. if (-not $NoPush) {
  43. git push origin HEAD
  44. if ($LASTEXITCODE -ne 0) {
  45. throw 'Release commit was created, but git push failed. Resolve the remote issue and push the existing commit.'
  46. }
  47. }
  48. Write-Output "Released xinje-plc-programming v$nextVersion"