0

GitLab CI: manual publish

This commit is contained in:
2021-10-21 18:33:16 +03:00
parent 86a1c3ab9c
commit f923f47765
3 changed files with 37 additions and 6 deletions

3
.gitignore vendored
View File

@@ -10,3 +10,6 @@ out/
.gradle/
build/
publish.gradle
# OTHER #
secrets.properties

View File

@@ -1,11 +1,11 @@
//file:noinspection GroovyAssignabilityCheck
plugins {
id 'java'
id 'maven-publish'
}
def publishScript = file(rootProject.getProjectDir().getPath() + '/publish.gradle')
if (publishScript.exists()) {
apply from: publishScript.path
}
def secrets = new Properties()
file("secrets.properties").withInputStream { secrets.load(it) }
project.group = projectGroup
project.version = projectVersion
@@ -15,6 +15,7 @@ repositories {
mavenCentral()
maven { url 'https://hub.spigotmc.org/nexus/content/groups/public' }
maven { url 'https://dmx-mc-project.gitlab.io/maven-repository/' }
maven { url "https://gitlab.com/api/v4/projects/${project.property('gitlab.projectid')}/packages/maven" }
}
ext {
@@ -76,4 +77,29 @@ dependencies {
test {
useJUnitPlatform()
}
}
publishing {
publications {
mavenBinary(MavenPublication) {
groupId = project.property('projectGroup')
artifactId = project.property('projectName')
version = project.property('projectVersion')
from components.java
}
}
repositories {
maven {
url "https://gitlab.com/api/v4/projects/${project.property('gitlab.projectid')}/packages/maven"
credentials(HttpHeaderCredentials) {
name = 'Private-Token'
value = secrets.getProperty('gitlab.privateToken')
}
authentication {
header(HttpHeaderAuthentication)
}
}
}
}

View File

@@ -1,3 +1,5 @@
projectGroup=ghast
projectName=ghast-tools
projectVersion=1.12.1
projectVersion=1.12.1
gitlab.projectid=23328133