Skip to content

Commit

Permalink
Add github-packages publishing
Browse files Browse the repository at this point in the history
  • Loading branch information
TBlueF committed Jul 28, 2022
1 parent 92c438e commit b359ec9
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 2 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- 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
run: ./gradlew build
run: ./gradlew clean build test
- uses: actions/upload-artifact@v2-preview
with:
name: artifact
Expand Down
22 changes: 22 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -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
21 changes: 21 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import java.io.IOException
plugins {
java
`java-library`
`maven-publish`
id("com.diffplug.spotless") version "6.1.2"
}

Expand Down Expand Up @@ -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"
}
}
}

0 comments on commit b359ec9

Please sign in to comment.