Skip to content

Commit 252d5c3

Browse files
authored
read org and repo out of git url (#241)
1 parent 76e187b commit 252d5c3

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

Jenkinsfile

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,13 @@ pipeline {
1111
stage('Init') {
1212
steps {
1313
checkout scm
14+
script {
15+
def m = (env.GIT_URL =~ /(\/|:)(([^\/]+)\/)?(([^\/]+?)(\.git)?)$/)
16+
if (m) {
17+
org = m.group(3)
18+
repo = m.group(5)
19+
}
20+
}
1421
}
1522
}
1623
stage('Setup build') {
@@ -45,9 +52,9 @@ pipeline {
4552
when { buildingTag(); not { changeRequest() } }
4653
steps {
4754
withCredentials([usernamePassword(credentialsId: 'brandonarp-github-token', usernameVariable: 'GITHUB_USERNAME', passwordVariable: 'GITHUB_TOKEN')]) {
48-
sh "github-release release --user ArpNetworking --repo metrics-aggregator-daemon --tag ${TAG_NAME}"
49-
sh "github-release upload --user ArpNetworking --repo metrics-aggregator-daemon --tag ${TAG_NAME} --name ${TAG_NAME}.tgz --file target/metrics-aggregator-daemon*.tgz"
50-
sh "github-release upload --user ArpNetworking --repo metrics-aggregator-daemon --tag ${TAG_NAME} --name ${TAG_NAME}.rpm --file target/rpm/metrics-aggregator-daemon/RPMS/noarch/metrics-aggregator-daemon-*.rpm"
55+
sh "github-release release --user ${org} --repo ${repo} --tag ${TAG_NAME}"
56+
sh "github-release upload --user ${org} --repo ${repo} --tag ${TAG_NAME} --name ${TAG_NAME}.tgz --file target/metrics-aggregator-daemon*.tgz"
57+
sh "github-release upload --user ${org} --repo ${repo} --tag ${TAG_NAME} --name ${TAG_NAME}.rpm --file target/rpm/metrics-aggregator-daemon/RPMS/noarch/metrics-aggregator-daemon-*.rpm"
5158
}
5259
}
5360
}

0 commit comments

Comments
 (0)