Skip to content

Commit b359ec9

Browse files
committed
Add github-packages publishing
1 parent 92c438e commit b359ec9

File tree

3 files changed

+45
-2
lines changed

3 files changed

+45
-2
lines changed

.github/workflows/gradle.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@ jobs:
66
build:
77
runs-on: ubuntu-latest
88
steps:
9-
- uses: actions/checkout@v1
9+
- uses: actions/checkout@v3
1010
with:
1111
submodules: recursive
1212
- name: Set up Java 11
1313
uses: actions/setup-java@v1
1414
with:
1515
java-version: 11
1616
- name: Build with Gradle
17-
run: ./gradlew build
17+
run: ./gradlew clean build test
1818
- uses: actions/upload-artifact@v2-preview
1919
with:
2020
name: artifact

.github/workflows/publish.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: Java CI
2+
3+
on:
4+
release:
5+
types: [ published ]
6+
7+
jobs:
8+
build:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v3
12+
with:
13+
submodules: recursive
14+
- name: Set up Java 11
15+
uses: actions/setup-java@v1
16+
with:
17+
java-version: 11
18+
- name: Build with Gradle
19+
env:
20+
GITHUB_USERNAME: ${{ secrets.github.actor }}
21+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
22+
run: ./gradlew clean build test publish

build.gradle.kts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import java.io.IOException
33
plugins {
44
java
55
`java-library`
6+
`maven-publish`
67
id("com.diffplug.spotless") version "6.1.2"
78
}
89

@@ -88,3 +89,23 @@ tasks.processResources {
8889
)
8990
}
9091
}
92+
93+
publishing {
94+
repositories {
95+
maven {
96+
name = "GitHubPackages"
97+
url = uri("https://maven.pkg.github.com/BlueMap-Minecraft/BlueMapAPI")
98+
credentials {
99+
username = project.findProperty("gpr.user") as String? ?: System.getenv("GITHUB_USERNAME")
100+
password = project.findProperty("gpr.key") as String? ?: System.getenv("GITHUB_TOKEN")
101+
}
102+
}
103+
}
104+
105+
publications {
106+
register<MavenPublication>("gpr") {
107+
from(components["java"])
108+
artifactId = "BlueMapAPI"
109+
}
110+
}
111+
}

0 commit comments

Comments
 (0)