Skip to content

Commit 867590b

Browse files
fix
1 parent b4207e2 commit 867590b

File tree

1 file changed

+25
-27
lines changed

1 file changed

+25
-27
lines changed

scripts/main.ps1

+25-27
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ Write-Output '::group::Environment variables'
2828
Get-ChildItem -Path Env: | Select-Object Name, Value | Sort-Object Name | Format-Table -AutoSize
2929
Write-Output '::endgroup::'
3030

31-
Write-Output "::group::Set configuration"
31+
Write-Output '::group::Set configuration'
3232
if (-not (Test-Path -Path $env:ConfigurationFile -PathType Leaf)) {
3333
Write-Output "Configuration file not found at [$env:ConfigurationFile]"
3434
} else {
@@ -214,40 +214,38 @@ if ($createPrerelease -or $createRelease) {
214214
Write-Error "Failed to create the release [$newVersion]."
215215
exit $LASTEXITCODE
216216
}
217-
return
218-
}
219-
220-
gh release create $newVersion --title $newVersion --generate-notes
221-
if ($LASTEXITCODE -ne 0) {
222-
Write-Error "Failed to create the release [$newVersion]."
223-
exit $LASTEXITCODE
224-
}
225-
226-
if ($createMajorTag) {
227-
$majorTag = ('{0}{1}' -f $versionPrefix, $major)
228-
git tag -f $majorTag 'main'
217+
} else {
218+
gh release create $newVersion --title $newVersion --generate-notes
229219
if ($LASTEXITCODE -ne 0) {
230-
Write-Error "Failed to create major tag [$majorTag]."
220+
Write-Error "Failed to create the release [$newVersion]."
231221
exit $LASTEXITCODE
232222
}
233-
}
234223

235-
if ($createMinorTag) {
236-
$minorTag = ('{0}{1}.{2}' -f $versionPrefix, $major, $minor)
237-
git tag -f $minorTag 'main'
224+
if ($createMajorTag) {
225+
$majorTag = ('{0}{1}' -f $versionPrefix, $major)
226+
git tag -f $majorTag 'main'
227+
if ($LASTEXITCODE -ne 0) {
228+
Write-Error "Failed to create major tag [$majorTag]."
229+
exit $LASTEXITCODE
230+
}
231+
}
232+
233+
if ($createMinorTag) {
234+
$minorTag = ('{0}{1}.{2}' -f $versionPrefix, $major, $minor)
235+
git tag -f $minorTag 'main'
236+
if ($LASTEXITCODE -ne 0) {
237+
Write-Error "Failed to create minor tag [$minorTag]."
238+
exit $LASTEXITCODE
239+
}
240+
}
241+
242+
git push origin --tags --force
238243
if ($LASTEXITCODE -ne 0) {
239-
Write-Error "Failed to create minor tag [$minorTag]."
244+
Write-Error 'Failed to push tags.'
240245
exit $LASTEXITCODE
241246
}
247+
Write-Output '::endgroup::'
242248
}
243-
244-
git push origin --tags --force
245-
if ($LASTEXITCODE -ne 0) {
246-
Write-Error 'Failed to push tags.'
247-
exit $LASTEXITCODE
248-
}
249-
Write-Output '::endgroup::'
250-
251249
} else {
252250
Write-Output 'Skipping release creation.'
253251
}

0 commit comments

Comments
 (0)