Skip to content

Instantly share code, notes, and snippets.

@2018kguo
Last active April 22, 2021 16:34
Show Gist options
  • Save 2018kguo/47f88e73a802790ae992b4044a09c330 to your computer and use it in GitHub Desktop.
Save 2018kguo/47f88e73a802790ae992b4044a09c330 to your computer and use it in GitHub Desktop.
Jenkinsfile snippet #2
environment {
OCTOPUS_ID = ""
DOCKER_REGISTRY = ""
VERSION = "$BUILD_TIMESTAMP"
DEPLOY = ""
RELEASE_NOTES = sh (script: """git log --format="medium" -1 ${GIT_COMMIT}""", returnStdout:true)
}
stages {
...
stage ("Create/Deploy Release") {
steps {
withCredentials([string(credentialsId: "OctopusApiKey", variable: "OCTOPUS_CLI_API_KEY")]) {
sh """
dotnet octo create-release --project "$OCTOPUS_ID" \
$DEPLOY --packageVersion $VERSION \
--releaseNotes "$RELEASE_NOTES"
"""
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment