Skip to content
Open
Show file tree
Hide file tree
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
13 changes: 9 additions & 4 deletions .octopus/deployment_process.ocl
Original file line number Diff line number Diff line change
Expand Up @@ -220,18 +220,22 @@ step "publish-winget-update-pr" {
'Accept' = "application/vnd.github+json";
'X-GitHub-Api-Version' = "2022-11-28";
}

$githubAccount = $OctopusParameters["Publish:Winget:GithubAccount"]
$githubPat = $OctopusParameters["Publish:Winget:GitHubPAT"]
$forkRepo = "$githubAccount/winget-pkgs"

try {

# Delete the fork of the winget-pkgs repo using the bot's token
$response = Invoke-WebRequest -Method "DELETE" -Uri "https://api.github.com/repos/team-integrations-fnm-bot/winget-pkgs" -Authentication "Bearer" -Token $OctopusParameters["Publish:Winget:GitHubPAT"] -Headers $headers
$response = Invoke-WebRequest -Method "DELETE" -Uri "https://api.github.com/repos/$forkRepo" -Authentication "Bearer" -Token $githubPat -Headers $headers
$statusCode = $Response.StatusCode
}
catch {
$statusCode = $_.Exception.Response.StatusCode.value__
}

if (!($statusCode -ge 200 -and $statusCode -le 299 )) {
Write-Warning "Failed to delete fork repo 'team-integrations-fnm-bot/winget-pkgs'. If this fork is too far behind its source, winget-create may fail."
Write-Warning "Failed to delete fork repo '$forkRepo'. If this fork is too far behind its source, winget-create may fail."
}


Expand All @@ -251,7 +255,8 @@ step "publish-winget-update-pr" {
$Env:DOTNET_ROOT = "C:\Users\ContainerAdministrator\AppData\Local\Microsoft\dotnet"

# This will perform the update and also create a PR with the relevant update
.\wingetcreate.exe update OctopusDeploy.Cli --urls $packageUrls --version $version --token $OctopusParameters["Publish:Winget:GitHubPAT"] --submit
.\wingetcreate.exe update OctopusDeploy.Cli --urls $packageUrls --version $version --token $githubPat --submit

EOT
Octopus.Action.Script.ScriptSource = "Inline"
Octopus.Action.Script.Syntax = "PowerShell"
Expand Down
2 changes: 1 addition & 1 deletion .octopus/schema_version.ocl
Original file line number Diff line number Diff line change
@@ -1 +1 @@
version = 9
version = 10
Loading