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/ .gradle/
build/ build/
publish.gradle publish.gradle
# OTHER #
secrets.properties

View File

@@ -1,11 +1,11 @@
//file:noinspection GroovyAssignabilityCheck
plugins { plugins {
id 'java' id 'java'
id 'maven-publish'
} }
def publishScript = file(rootProject.getProjectDir().getPath() + '/publish.gradle') def secrets = new Properties()
if (publishScript.exists()) { file("secrets.properties").withInputStream { secrets.load(it) }
apply from: publishScript.path
}
project.group = projectGroup project.group = projectGroup
project.version = projectVersion project.version = projectVersion
@@ -15,6 +15,7 @@ repositories {
mavenCentral() mavenCentral()
maven { url 'https://hub.spigotmc.org/nexus/content/groups/public' } maven { url 'https://hub.spigotmc.org/nexus/content/groups/public' }
maven { url 'https://dmx-mc-project.gitlab.io/maven-repository/' } 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 { ext {
@@ -77,3 +78,28 @@ dependencies {
test { test {
useJUnitPlatform() 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 projectGroup=ghast
projectName=ghast-tools projectName=ghast-tools
projectVersion=1.12.1 projectVersion=1.12.1
gitlab.projectid=23328133