forked from Upstream/Velocitab
ci: add publishing to maven
This commit is contained in:
parent
3d15022565
commit
51d607a6bb
7
.github/workflows/java_ci.yml
vendored
7
.github/workflows/java_ci.yml
vendored
@ -23,9 +23,12 @@ jobs:
|
|||||||
java-version: '16'
|
java-version: '16'
|
||||||
distribution: 'temurin'
|
distribution: 'temurin'
|
||||||
- name: Build with Gradle
|
- name: Build with Gradle
|
||||||
uses: gradle/gradle-build-action@67421db6bd0bf253fb4bd25b31ebb98943c375e1
|
uses: gradle/gradle-build-action@v2
|
||||||
with:
|
with:
|
||||||
arguments: build
|
arguments: build test publish
|
||||||
|
env:
|
||||||
|
SNAPSHOTS_MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }}
|
||||||
|
SNAPSHOTS_MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }}
|
||||||
- name: Query Version
|
- name: Query Version
|
||||||
run: |
|
run: |
|
||||||
echo "::set-output name=VERSION_NAME::$(${{github.workspace}}/gradlew properties --no-daemon --console=plain -q | grep "^version:" | awk '{printf $2}')"
|
echo "::set-output name=VERSION_NAME::$(${{github.workspace}}/gradlew properties --no-daemon --console=plain -q | grep "^version:" | awk '{printf $2}')"
|
||||||
|
7
.github/workflows/release.yml
vendored
7
.github/workflows/release.yml
vendored
@ -19,9 +19,12 @@ jobs:
|
|||||||
java-version: '16'
|
java-version: '16'
|
||||||
distribution: 'temurin'
|
distribution: 'temurin'
|
||||||
- name: Build with Gradle
|
- name: Build with Gradle
|
||||||
uses: gradle/gradle-build-action@67421db6bd0bf253fb4bd25b31ebb98943c375e1
|
uses: gradle/gradle-build-action@v2
|
||||||
with:
|
with:
|
||||||
arguments: build
|
arguments: build test publish
|
||||||
|
env:
|
||||||
|
RELEASES_MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }}
|
||||||
|
RELEASES_MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }}
|
||||||
- name: Query Version
|
- name: Query Version
|
||||||
run: |
|
run: |
|
||||||
echo "::set-output name=VERSION_NAME::$(${{github.workspace}}/gradlew properties --no-daemon --console=plain -q | grep "^version:" | awk '{printf $2}')"
|
echo "::set-output name=VERSION_NAME::$(${{github.workspace}}/gradlew properties --no-daemon --console=plain -q | grep "^version:" | awk '{printf $2}')"
|
||||||
|
52
build.gradle
52
build.gradle
@ -4,6 +4,7 @@ plugins {
|
|||||||
id 'com.github.johnrengelman.shadow' version '8.1.1'
|
id 'com.github.johnrengelman.shadow' version '8.1.1'
|
||||||
id 'org.cadixdev.licenser' version '0.6.1'
|
id 'org.cadixdev.licenser' version '0.6.1'
|
||||||
id 'org.ajoberstar.grgit' version '5.2.0'
|
id 'org.ajoberstar.grgit' version '5.2.0'
|
||||||
|
id 'maven-publish'
|
||||||
id 'java'
|
id 'java'
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -66,6 +67,15 @@ logger.lifecycle("Building Velocitab ${version} by William278")
|
|||||||
version rootProject.version
|
version rootProject.version
|
||||||
archivesBaseName = "${rootProject.name}"
|
archivesBaseName = "${rootProject.name}"
|
||||||
|
|
||||||
|
compileJava.options.encoding = 'UTF-8'
|
||||||
|
javadoc.options.encoding = 'UTF-8'
|
||||||
|
javadoc.options.addStringOption('Xdoclint:none', '-quiet')
|
||||||
|
|
||||||
|
java {
|
||||||
|
withSourcesJar()
|
||||||
|
withJavadocJar()
|
||||||
|
}
|
||||||
|
|
||||||
shadowJar {
|
shadowJar {
|
||||||
relocate 'org.apache.commons.text', 'net.william278.velocitab.libraries.commons.text'
|
relocate 'org.apache.commons.text', 'net.william278.velocitab.libraries.commons.text'
|
||||||
relocate 'org.apache.commons.lang3', 'net.william278.velocitab.libraries.commons.lang3'
|
relocate 'org.apache.commons.lang3', 'net.william278.velocitab.libraries.commons.lang3'
|
||||||
@ -89,6 +99,48 @@ shadowJar {
|
|||||||
jar.dependsOn shadowJar
|
jar.dependsOn shadowJar
|
||||||
clean.delete "$rootDir/target"
|
clean.delete "$rootDir/target"
|
||||||
|
|
||||||
|
publishing {
|
||||||
|
repositories {
|
||||||
|
if (System.getenv("RELEASES_MAVEN_USERNAME") != null) {
|
||||||
|
maven {
|
||||||
|
name = "william278-releases"
|
||||||
|
url = "https://repo.william278.net/releases"
|
||||||
|
credentials {
|
||||||
|
username = System.getenv("RELEASES_MAVEN_USERNAME")
|
||||||
|
password = System.getenv("RELEASES_MAVEN_PASSWORD")
|
||||||
|
}
|
||||||
|
authentication {
|
||||||
|
basic(BasicAuthentication)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (System.getenv("SNAPSHOTS_MAVEN_USERNAME") != null) {
|
||||||
|
maven {
|
||||||
|
name = "william278-snapshots"
|
||||||
|
url = "https://repo.william278.net/snapshots"
|
||||||
|
credentials {
|
||||||
|
username = System.getenv("SNAPSHOTS_MAVEN_USERNAME")
|
||||||
|
password = System.getenv("SNAPSHOTS_MAVEN_PASSWORD")
|
||||||
|
}
|
||||||
|
authentication {
|
||||||
|
basic(BasicAuthentication)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
publications {
|
||||||
|
mavenJava(MavenPublication) {
|
||||||
|
groupId = 'net.william278'
|
||||||
|
artifactId = 'velocitab'
|
||||||
|
version = "$rootProject.version"
|
||||||
|
artifact shadowJar
|
||||||
|
artifact javadocJar
|
||||||
|
artifact sourcesJar
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@SuppressWarnings('GrMethodMayBeStatic')
|
@SuppressWarnings('GrMethodMayBeStatic')
|
||||||
def versionMetadata() {
|
def versionMetadata() {
|
||||||
// Get if there is a tag for this commit
|
// Get if there is a tag for this commit
|
||||||
|
Loading…
Reference in New Issue
Block a user