-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathGitLabReleasePublicizer.cfc
More file actions
53 lines (49 loc) · 1.92 KB
/
GitLabReleasePublicizer.cfc
File metadata and controls
53 lines (49 loc) · 1.92 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
component implements="interfaces.ReleasePublicizer" {
property name="versionPrefix" inject="commandbox:moduleSettings:commandbox-semantic-release:versionPrefix";
property name="targetBranch" inject="commandbox:moduleSettings:commandbox-semantic-release:targetBranch";
property name="systemSettings" inject="SystemSettings";
/**
* Publishes the release notes to GitHub.
*
* @notes The release notes to publish.
* @nextVersion The next version of the package.
* @repositoryUrl The url of the remote repository.
* @dryRun Flag to indicate a dry run of the release.
* @verbose Flag to indicate printing out extra information.
* @targetBranch The branch that builds are triggered against.
*/
public void function run(
required string notes,
required string nextVersion,
required string repositoryUrl,
boolean dryRun = false,
boolean verbose = false,
string targetBranch = variables.targetBranch
) {
if ( dryRun ) {
return;
}
cfhttp(
method = "POST",
url = "#systemSettings.getSystemSetting( "CI_API_V4_URL" )#/projects/#systemSettings.getSystemSetting( "CI_PROJECT_ID", "" )#/releases",
throwonerror="true"
) {
cfhttpparam(
type="header",
name="Content-Type",
value="application/json"
);
cfhttpparam(
type="header",
name="JOB-TOKEN",
value="#systemSettings.getSystemSetting( "CI_JOB_TOKEN" )#"
);
cfhttpparam( type = "body", value = serializeJSON( {
"name": "#versionPrefix##nextVersion#",
"tag_name": "#versionPrefix##nextVersion#",
"ref": arguments.targetBranch,
"description": notes
} ) );
}
}
}