Skip to content

Commit

Permalink
Prepare plugin for deployment into GitLab Maven repository for JOSM p…
Browse files Browse the repository at this point in the history
…lugins
  • Loading branch information
floscher committed Sep 30, 2018
1 parent 5d8911c commit 1144fa3
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 10 deletions.
26 changes: 17 additions & 9 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,5 @@
image: registry.gitlab.com/josm/docker-library/openjdk-8-josmplugin:latest

before_script:
- export GRADLE_USER_HOME=`pwd`/.gradle

cache:
paths:
- .gradle/wrapper
- .gradle/caches


###############
# Build stage #
###############
Expand Down Expand Up @@ -104,6 +95,8 @@ codecov.io:
only:
refs:
- master@JOSM/Mapillary
variables:
- $CODECOV_TOKEN

sonarcloud.io:
image: registry.gitlab.com/josm/docker-library/openjdk-8-josmplugin:latest
Expand All @@ -121,6 +114,21 @@ sonarcloud.io:
variables:
- $SONAR_TOKEN

GitLab Maven repo:
stage: deploy
environment:
name: GitLab Maven Repository for JOSM plugins
url: https://gitlab.com/JOSM/plugins/-/packages
script:
- ./gradlew publish
dependencies:
- build
only:
refs:
- tags@JOSM/Mapillary
variables:
- $PERSONAL_ACCESS_TOKEN

release:
stage: deploy
environment:
Expand Down
47 changes: 46 additions & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ tasks.withType<JavaCompile>().configureEach {
apply(from = "gradle/tool-config.gradle")

java.sourceCompatibility = JavaVersion.VERSION_1_8
convention.getPlugin(BasePluginConvention::class.java).archivesBaseName = "Mapillary"
base.archivesBaseName = "Mapillary"

dependencies {
testImplementation ("org.openstreetmap.josm:josm-unittest:SNAPSHOT"){ isChanging = true }
Expand Down Expand Up @@ -152,3 +152,48 @@ tasks {
}
}
}

// Configuration for publishing to Maven repository at gitlab.com/JOSM/plugins
val PROJECT_ID = 8611940 // repository JOSM/plugins
val PERSONAL_ACCESS_TOKEN = System.getenv("PERSONAL_ACCESS_TOKEN")

publishing {
repositories {
maven("https://gitlab.com/api/v4/projects/$PROJECT_ID/packages/maven") {
if (PERSONAL_ACCESS_TOKEN != null) {
credentials(HttpHeaderCredentials::class) {
name = "Private-Token"
value = PERSONAL_ACCESS_TOKEN
}
authentication {
removeAll { a -> true }
create("auth", HttpHeaderAuthentication::class)
}
}
}
}
publications {
create("plugins", MavenPublication::class) {
artifactId = base.archivesBaseName
groupId = "org.openstreetmap.josm.plugins"
version = project.version.toString()
from(components["java"])
pom {
name.set("JOSM-${base.archivesBaseName}")
description.set("The Mapillary plugin for JOSM")
url.set("https://gitlab.com/JOSM/Mapillary")
licenses {
license {
name.set("GNU General Public License Version 2")
url.set("https://www.gnu.org/licenses/old-licenses/gpl-2.0")
}
}
scm {
connection.set("scm:git:git://gitlab.com/JOSM/Mapillary.git")
developerConnection.set("scm:git:ssh://gitlab.com/JOSM/Mapillary.git")
url.set("https://gitlab.com/JOSM/Mapillary")
}
}
}
}
}

0 comments on commit 1144fa3

Please sign in to comment.