Skip to content

Commit 56cc38c

Browse files
authored
Merge pull request #488 from IETS3/feature/ghp
build: added publication to github packages
2 parents 5936f35 + 298832f commit 56cc38c

File tree

1 file changed

+20
-3
lines changed

1 file changed

+20
-3
lines changed

build.gradle

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ def mbeddrVersion = "2020.3+"
7171
// the name is enough no trailing "." is required, also the plain name from git can
7272
// be used here. No need to convert "/" the script will take care of that.
7373
def mbeddrBranch = ""
74+
def currentBranch = ""
7475

7576

7677
if (mbeddrBranch != null && !mbeddrBranch.trim().isEmpty()) {
@@ -85,10 +86,10 @@ if (project.hasProperty('iets3OpenSourceVersion')) {
8586
version = project.iets3OpenSourceVersion
8687
} else {
8788
if (ciBuild) {
88-
String branch = GitBasedVersioning.gitBranch
89+
currentBranch = GitBasedVersioning.gitBranch
8990

9091
def buildNumber = System.env.BUILD_NUMBER.toInteger()
91-
if (branch.startsWith("maintenance") || branch.startsWith("mps")) {
92+
if (currentBranch.startsWith("maintenance") || currentBranch.startsWith("mps")) {
9293
version = "$major.$minor.$buildNumber.${GitBasedVersioning.gitShortCommitHash}"
9394
} else {
9495
version = GitBasedVersioning.getVersionWithCount(major, minor, buildNumber)
@@ -260,6 +261,21 @@ publishing {
260261
}
261262
}
262263
}
264+
repositories {
265+
if(currentBranch == "master" || currentBranch.startsWith("maintenance") || currentBranch.startsWith("mps")) {
266+
maven {
267+
name = "GitHubPackages"
268+
url = uri("https://maven.pkg.github.com/IETS3/iets3.opensource")
269+
if(project.hasProperty("gpr.token")) {
270+
credentials {
271+
username = project.findProperty("gpr.user")
272+
password = project.findProperty("gpr.token")
273+
}
274+
}
275+
}
276+
}
277+
}
278+
263279
publications {
264280
allScripts(MavenPublication) {
265281
groupId 'org.iets3.opensource'
@@ -307,6 +323,7 @@ publishing {
307323
}
308324
}
309325

326+
310327
task generateLibrariesXml(type: GenerateLibrariesXml) {
311328
dependsOn resolveLanguageLibs
312329
description "Will read project libraries from projectlibraries.properties and generate libraries.xml in .mps directory. Libraries are loaded in mps during start."
@@ -362,4 +379,4 @@ githubRelease.doFirst {
362379
}
363380
}
364381

365-
githubRelease.dependsOn packageDistroWithDependencies
382+
githubRelease.dependsOn packageDistroWithDependencies

0 commit comments

Comments
 (0)