Skip to content

Commit b283f70

Browse files
committed
Add option to sign Git tags
fixes #207
1 parent a04e72f commit b283f70

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/main/groovy/net/researchgate/release/GitAdapter.groovy

+6-1
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ class GitAdapter extends BaseScmAdapter {
3030
String requireBranch = 'master'
3131
def pushToRemote = 'origin' // needs to be def as can be boolean or string
3232
def pushOptions = []
33+
boolean signTag = false
3334

3435
/** @deprecated Remove in version 3.0 */
3536
@Deprecated
@@ -108,7 +109,11 @@ class GitAdapter extends BaseScmAdapter {
108109
@Override
109110
void createReleaseTag(String message) {
110111
def tagName = tagName()
111-
exec(['git', 'tag', '-a', tagName, '-m', message], directory: workingDirectory, errorMessage: "Duplicate tag [$tagName]", errorPatterns: ['already exists'])
112+
def params = ['git', 'tag', '-a', tagName, '-m', message]
113+
if (extension.git.signTag) {
114+
params.add('-s')
115+
}
116+
exec(params, directory: workingDirectory, errorMessage: "Duplicate tag [$tagName]", errorPatterns: ['already exists'])
112117
if (shouldPush()) {
113118
exec(['git', 'push', '--porcelain', extension.git.pushToRemote, tagName] + extension.git.pushOptions, directory: workingDirectory, errorMessage: "Failed to push tag [$tagName] to remote", errorPatterns: ['[rejected]', 'error: ', 'fatal: '])
114119
}

0 commit comments

Comments
 (0)