Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Clone over http(s) #15

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions src/io/stenic/jpipe/plugin/ConventionalCommitPlugin.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ class ConventionalCommitPlugin extends Plugin {
private runRelease(script, cmdArgs) {
Boolean configCreated = false
String configFile = 'release.config.cjs'
String gitUrl = script.scm.getUserRemoteConfigs()[0].getUrl()

if (!script.fileExists("./${configFile}")) {
def releasercCfg = script.libraryResource "io/stenic/jpipe/release/${configFile}"
script.writeFile file: configFile, text: releasercCfg
Expand All @@ -91,10 +93,19 @@ class ConventionalCommitPlugin extends Plugin {
script.withEnv([
"RELEASE_BRANCHES=${this.releaseBranches}",
"PRERELEASE_BRANCHES=${this.prereleaseBranches}",
"GIT_URL=${script.scm.getUserRemoteConfigs()[0].getUrl()}",
"GIT_URL=${gitUrl}"
]) {
script.sshagent(credentials: [script.scm.getUserRemoteConfigs()[0].getCredentialsId()]) {
script.sh "semantic-release ${cmdArgs}"
if (gitUrl.startsWith("http")) {
withCredentials([usernamePassword(credentialsId: "semantic-release-credential", usernameVariable: 'USERNAME', passwordVariable: 'PASSWORD')]) {
script.withEnv(["GIT_CREDENTIALS=${USERNAME}:${PASSWORD}"]) {
script.sh "semantic-release ${cmdArgs}"
}
}
}
else {
script.sshagent(credentials: [script.scm.getUserRemoteConfigs()[0].getCredentialsId()]) {
script.sh "semantic-release ${cmdArgs}"
}
}
}

Expand Down
Loading