You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
62 lines
1.6 KiB
PowerShell
62 lines
1.6 KiB
PowerShell
<#
|
|
.SYNOPSIS
|
|
Create a new release on on a Gitea site using the Gitea API
|
|
|
|
.DESCRIPTION
|
|
The Add-Numbers function takes two integer parameters, $Number1 and $Number2,
|
|
and returns the sum of those two numbers.
|
|
|
|
.PARAMETER APIURL
|
|
The Repo Releases API URL of the Gitea site, including the API Key.
|
|
Example: "https://gitea.example.com/api/v1/repos/yuriy/TESTREPO/releases?token=aaabbbcccdd"
|
|
|
|
.PARAMETER ReleaseName
|
|
Name for the release that will be created
|
|
|
|
.PARAMETER ReleaseTag
|
|
Tag for the release that will be created
|
|
|
|
.PARAMETER ReleaseBody
|
|
Body Text for the release that will be created
|
|
|
|
.EXAMPLE
|
|
Gitea-CreateRelease.ps1 "https://gitea.example.com/api/v1/repos/yuriy/TESTREPO/releases?token=aaabbbcccdd" "1.0" "1.0" "Initial Release"
|
|
|
|
.NOTES
|
|
This function was created as an example for a PowerShell documentation demonstration.
|
|
|
|
.LINK
|
|
https://example.com/powershell-functions
|
|
#>
|
|
|
|
|
|
$APIURL=$args[0]
|
|
$ReleaseName=$args[1]
|
|
$ReleaseTag=$args[2]
|
|
$ReleaseBody=$args[3]
|
|
|
|
<#
|
|
Write-Host "APIURL: $APIURL"
|
|
Write-Host "ReleaseTag: $ReleaseTag"
|
|
Write-Host "ReleaseName: $ReleaseName"
|
|
Write-Host "ReleaseBody: $ReleaseBody"
|
|
#>
|
|
|
|
$headers = @{
|
|
"accept" = "application/json"
|
|
"Content-Type" = "application/json"
|
|
}
|
|
$body = @{
|
|
"body" = "${ReleaseBody}"
|
|
"draft" = $false
|
|
"name" = "${ReleaseTag}"
|
|
"prerelease" = $false
|
|
"tag_name" = "${ReleaseTag}"
|
|
# "target_commitish" = "string"
|
|
} | ConvertTo-Json
|
|
|
|
# Write-Host "body: " $body
|
|
|
|
$Result = Invoke-RestMethod -Uri $APIURL -Method Post -Headers $headers -Body $body
|
|
|
|
Write-Host $Result |