Skip to content

Commit 6ee3284

Browse files
committed
Adds create release step
1 parent 1649290 commit 6ee3284

File tree

2 files changed

+173
-0
lines changed

2 files changed

+173
-0
lines changed
Lines changed: 4 additions & 0 deletions
Loading
Lines changed: 169 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,169 @@
1+
version: "1.0"
2+
kind: step-type
3+
metadata:
4+
name: octopusdeploy-create-release
5+
version: 1.0.0
6+
title: Create a release in Octopus Deploy
7+
isPublic: true
8+
description: Create a release in Octopus Deploy
9+
sources:
10+
- "https://github.com/codefresh-io/steps/tree/master/incubating/octopusdeploy-create-release"
11+
stage: incubating
12+
official: true
13+
categories:
14+
- deployment
15+
icon:
16+
type: svg
17+
url: "https://cdn.jsdelivr.net/gh/codefresh-io/steps/incubating/octopusdeploy-create-release/create_release.svg"
18+
background: "#F4F6F8"
19+
maintainers:
20+
- name: OctopusDeploy
21+
examples:
22+
- description: Basic usage of the create release step
23+
workflow:
24+
create-release:
25+
type: octopusdeploy-create-release
26+
arguments:
27+
OCTOPUS_API_KEY: "${{OCTOPUS_API_KEY}}"
28+
OCTOPUS_URL: "${{OCTOPUS_URL}}"
29+
OCTOPUS_SPACE: "Spaces 1"
30+
PROJECT: "Project Name"
31+
- description: Complex usage of the create release step
32+
workflow:
33+
create-release:
34+
type: octopusdeploy-create-release
35+
arguments:
36+
OCTOPUS_API_KEY: "${{OCTOPUS_API_KEY}}"
37+
OCTOPUS_URL: "${{OCTOPUS_URL}}"
38+
OCTOPUS_SPACE: "Spaces 1"
39+
PROJECT: "Project Name"
40+
RELEASE_NUMBER: "1.0.0"
41+
CHANNEL: "Channel Name"
42+
GIT_REF: "refs/heads/main"
43+
GIT_COMMIT: "Commit ID"
44+
PACKAGE_VERSION: "1.0.0"
45+
PACKAGES:
46+
- "Package:1.0.0"
47+
RELEASE_NOTES: "This is a release note"
48+
RELEASE_NOTES_FILE: "/release-notes.txt"
49+
IGNORE_EXISTING: false
50+
spec:
51+
arguments: |-
52+
{
53+
"definitions": {},
54+
"$schema": "http://json-schema.org/draft-07/schema#",
55+
"type": "object",
56+
"name": "octopusdeploy-create-release",
57+
"additionalProperties": false,
58+
"patterns": [],
59+
"required": ["OCTOPUS_API_KEY", "OCTOPUS_URL", "OCTOPUS_SPACE", "PROJECT"],
60+
"properties": {
61+
"OCTOPUS_API_KEY": {
62+
"type": "string",
63+
"description": "API key for octopus deploy (required)"
64+
},
65+
"OCTOPUS_URL": {
66+
"type": "string",
67+
"description": "URL of the octopus deploy server (required)"
68+
},
69+
"OCTOPUS_SPACE": {
70+
"type": "string",
71+
"description": "API key for octopus deploy (required)"
72+
},
73+
"PROJECT": {
74+
"type": "string",
75+
"description": "The name of the project associated with this release (required)"
76+
},
77+
"RELEASE_NUMBER": {
78+
"type": "string",
79+
"description": "The release number to create (optional)"
80+
},
81+
"CHANNEL": {
82+
"type": "string",
83+
"description": "Name or ID of the channel to use"
84+
},
85+
"GIT_REF": {
86+
"type": "string",
87+
"description": "Git Reference e.g. refs/heads/main. Only relevant for config-as-code projects"
88+
},
89+
"GIT_COMMIT": {
90+
"type": "string",
91+
"description": "Git Commit Hash; Specify this in addition to Git Reference if you want to reference a commit other than the latest for that branch/tag."
92+
},
93+
"PACKAGE_VERSION": {
94+
"type": "string",
95+
"description": "Default version to use for all Packages"
96+
},
97+
"PACKAGES": {
98+
"type": "array",
99+
"description": "Version specification a specific packages. Format as {package}:{version}, {step}:{version} or {package-ref-name}:{packageOrStep}:{version}"
100+
},
101+
"RELEASE_NOTES": {
102+
"type": "string",
103+
"description": "Release notes to attach"
104+
},
105+
"RELEASE_NOTES_FILE": {
106+
"type": "string",
107+
"description": " Release notes to attach (from file)"
108+
},
109+
"IGNORE_EXISTING": {
110+
"type": "boolean",
111+
"description": "If a release with the same version exists, do nothing instead of failing."
112+
}
113+
}
114+
}
115+
returns: |-
116+
{
117+
"definitions": {},
118+
"$schema": "http://json-schema.org/draft-07/schema#",
119+
"type": "object",
120+
"additionalProperties": true,
121+
"patterns": [],
122+
"required": [
123+
"RELEASE"
124+
],
125+
"properties": {
126+
"RELEASE": {
127+
"additionalProperties": true,
128+
"type": "object",
129+
"description": "The release that was created",
130+
"properties": {
131+
"Channel": {
132+
"type": "string",
133+
"description": "The channel for this release"
134+
},
135+
"Version": {
136+
"type": "string",
137+
"description": "The version of this release"
138+
}
139+
}
140+
}
141+
}
142+
}
143+
stepsTemplate: |-
144+
create-release:
145+
name: octopusdeploy-create-release
146+
image: octopuslabs/octopus-cli
147+
tag: latest
148+
commands:
149+
- OUTPUT=$(octopus release create
150+
--project "[[.Arguments.PROJECT]]"
151+
--version "[[.Arguments.RELEASE_NUMBER]]"
152+
--no-prompt
153+
--output-format json
154+
[[- if .Arguments.PACKAGE_VERSION ]] --package-version "[[ .Arguments.PACKAGE_VERSION ]]" [[ end ]]
155+
[[- range $val := .Arguments.PACKAGES ]] --package "[[ $val ]]" [[ end ]]
156+
[[- if .Arguments.CHANNEL ]] --channel "[[ .Arguments.CHANNEL ]]" [[ end ]]
157+
[[- if .Arguments.GIT_REF ]] --git-ref "[[ .Arguments.GIT_REF ]]" [[ end ]]
158+
[[- if .Arguments.GIT_COMMIT ]] --git-commit "[[ .Arguments.GIT_COMMIT ]]" [[ end ]]
159+
[[- if .Arguments.RELEASE_NOTES ]] --release-notes "[[ .Arguments.RELEASE_NOTES ]]" [[ end ]]
160+
[[- if .Arguments.RELEASE_NOTES_FILE ]] --release-notes-file "[[ .Arguments.RELEASE_NOTES_FILE ]]" [[ end ]]
161+
[[- if .Arguments.IGNORE_EXISTING ]] --ignore-existing [[ end ]])
162+
- cf_export RELEASE=$OUTPUT
163+
environment:
164+
- 'OCTOPUS_URL=[[.Arguments.OCTOPUS_URL]]'
165+
- 'OCTOPUS_API_KEY=[[.Arguments.OCTOPUS_API_KEY]]'
166+
- 'OCTOPUS_SPACE=[[.Arguments.OCTOPUS_SPACE]]'
167+
delimiters:
168+
left: "[["
169+
right: "]]"

0 commit comments

Comments
 (0)