Add github-packages publishing

This commit is contained in:
Lukas Rieger (Blue) 2022-07-28 23:33:33 +02:00
parent 92c438e099
commit b359ec964c
No known key found for this signature in database
GPG Key ID: 2D09EC5ED2687FF2
3 changed files with 45 additions and 2 deletions

View File

@ -6,7 +6,7 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v3
with:
submodules: recursive
- name: Set up Java 11
@ -14,7 +14,7 @@ jobs:
with:
java-version: 11
- name: Build with Gradle
run: ./gradlew build
run: ./gradlew clean build test
- uses: actions/upload-artifact@v2-preview
with:
name: artifact

22
.github/workflows/publish.yml vendored Normal file
View File

@ -0,0 +1,22 @@
name: Java CI
on:
release:
types: [ published ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- name: Set up Java 11
uses: actions/setup-java@v1
with:
java-version: 11
- name: Build with Gradle
env:
GITHUB_USERNAME: ${{ secrets.github.actor }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: ./gradlew clean build test publish

View File

@ -3,6 +3,7 @@ import java.io.IOException
plugins {
java
`java-library`
`maven-publish`
id("com.diffplug.spotless") version "6.1.2"
}
@ -88,3 +89,23 @@ tasks.processResources {
)
}
}
publishing {
repositories {
maven {
name = "GitHubPackages"
url = uri("https://maven.pkg.github.com/BlueMap-Minecraft/BlueMapAPI")
credentials {
username = project.findProperty("gpr.user") as String? ?: System.getenv("GITHUB_USERNAME")
password = project.findProperty("gpr.key") as String? ?: System.getenv("GITHUB_TOKEN")
}
}
}
publications {
register<MavenPublication>("gpr") {
from(components["java"])
artifactId = "BlueMapAPI"
}
}
}