Skip to content

Commit

Permalink
ci: add a condition that we only publish when patch is set to 0
Browse files Browse the repository at this point in the history
  • Loading branch information
Seddryck committed Oct 30, 2023
1 parent 2cf62a6 commit 80b5096
Showing 1 changed file with 19 additions and 15 deletions.
34 changes: 19 additions & 15 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,21 +91,25 @@ deploy:
on_success:
- pwsh: |
. "$env:APPVEYOR_BUILD_FOLDER\github.ps1"
if (($env:APPVEYOR_REPO_BRANCH -eq "main") -and ($null -eq $env:APPVEYOR_PULL_REQUEST_NUMBER)) {
$context = [PSCustomObject] @{
Owner = ($env:APPVEYOR_REPO_NAME -Split '/')[0]
Repository = ($env:APPVEYOR_REPO_NAME -Split '/')[1]
SecretToken = $env:github_access_token
}
if ( -not ($context | Check-Release-Published -Tag "v$($env:GitVersion_SemVer)")) {
$context | Publish-Release `
-Tag "v$($env:GitVersion_SemVer)" `
-Name "$(($env:APPVEYOR_REPO_NAME -Split '/')[1]) $($env:GitVersion_SemVer)" `
-ReleaseNotes `
-DiscussionCategory 'Announcements'
}
if ($env:APPVEYOR_REPO_BRANCH -eq "main") {
if ($env:GitVersion_Patch -eq '0' -or $env:GitVersion_Patch -eq 0) {
$context = [PSCustomObject] @{
Owner = ($env:APPVEYOR_REPO_NAME -Split '/')[0]
Repository = ($env:APPVEYOR_REPO_NAME -Split '/')[1]
SecretToken = $env:github_access_token
if (-not ($context | Check-Release-Published -Tag "v$($env:GitVersion_SemVer)")) {
$context | Publish-Release `
-Tag "v$($env:GitVersion_SemVer)" `
-Name "$(($env:APPVEYOR_REPO_NAME -Split '/')[1]) $($env:GitVersion_SemVer)" `
-ReleaseNotes `
-DiscussionCategory 'Announcements'
}
} else {
Write-Host "No release published on GitHub when patch is not set to zero."
}
} else {
Write-Host "No release published on GitHub."
Write-Host "No release published on GitHub when not on branch main."
}
- pwsh: |
Expand Down Expand Up @@ -134,4 +138,4 @@ on_success:
Write-Host "`tPushing commit ..."
& git push origin
Write-Host "`tNew commit uploaded."
}
}

0 comments on commit 80b5096

Please sign in to comment.