Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 16 additions & 30 deletions scripts/update-version.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -12,33 +12,19 @@ Set-StrictMode -Version Latest
$ErrorActionPreference = "Stop"
$PSNativeCommandUseErrorActionPreference = $true

Write-Host "Updating version from $OldVersion to $NewVersion"

# Update specific workflow files with _workflow_version inputs
Write-Host "Updating workflow files..."
$workflowFiles = @(
".github/workflows/updater.yml",
".github/workflows/danger.yml"
)

foreach ($filePath in $workflowFiles) {
$content = Get-Content -Path $filePath -Raw

# Check if this file has _workflow_version input with a default value
if ($content -match '(?ms)_workflow_version:.*?default:\s*([^\s#]+)') {
Write-Host "Updating $filePath..."
$oldDefault = $Matches[1]

# Replace the default value for _workflow_version
$newContent = $content -replace '((?ms)_workflow_version:.*?default:\s*)([^\s#]+)', "`${1}'$NewVersion'"

# Write the updated content back to the file
$newContent | Out-File -FilePath $filePath -Encoding utf8 -NoNewline

Write-Host " Updated default from '$oldDefault' to '$NewVersion'"
} else {
Write-Error "No _workflow_version default found in $filePath"
}
}

Write-Host "Version update completed successfully!"
Write-Host "Preparing release version update from $OldVersion to $NewVersion"

# Note: Workflow files cannot be updated automatically during Craft releases
# because GitHub Apps don't have 'workflows' permission by default.
#
# After this release is published, manually update the following files:
# - .github/workflows/updater.yml (line ~45)
# - .github/workflows/danger.yml (line ~9)
#
# Change the default value from '$OldVersion' to '$NewVersion'

Write-Host ""
Write-Host "⚠️ MANUAL ACTION REQUIRED AFTER RELEASE:"
Write-Host "Update _workflow_version defaults in workflow files from '$OldVersion' to '$NewVersion'"
Write-Host ""
Write-Host "Release preparation completed successfully!"
Loading