Skip to content

Instantly share code, notes, and snippets.

@rhymeswithmogul
Created November 7, 2019 23:33
Show Gist options
  • Save rhymeswithmogul/8208b8f0b59f739bde411564d6831e9e to your computer and use it in GitHub Desktop.
Save rhymeswithmogul/8208b8f0b59f739bde411564d6831e9e to your computer and use it in GitHub Desktop.
Make a new release in GitLab until they add this as a sorely-needed point-and-click feature
#Requires -Version 3.0
#for Invoke-WebRequest
###
### FILL OUT THESE FIELDS
###
# You will need the following three pieces of information.
$GitLabServerAndPort = "gitlab.tailspintoys.com:4443" # the colon and port number can be omitted if it's 443
$APIAccessToken = "foo" # you can generate an API token in settings.
$ProjectID = "123" # the number shown on the project home page.
# You will also need to create the following.
# For more information, see https://docs.gitlab.com/ee/api/releases/index.html#create-a-release
$ReleaseName = "Cool New Version 1.1 (Codename: Fabrikam)"
$ReleaseTagName = "v1.1"
$ReleaseDescription = "This version fixes some stuff from version 1.0. My bad."
$ReleaseCommitSHA = "0123456789abcdef0123456789abcdef01234567"
###
### STOP EDITING
###
$args = {
Uri = "https://$GitLabServerAndPort/api/v4/projects/$ProjectID/releases"
Method = "POST"
Header = @{"PRIVATE-TOKEN" = $APIAccessToken}
Body = @{
id = $ProjectID
name = $ReleaseName
tag_name = $ReleaseTagName
description = $ReleaseDescription
ref = $ReleaseCommitSHA
}
}
Invoke-WebRequest @args
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment