-
Notifications
You must be signed in to change notification settings - Fork 81
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #515 from Multiverse/gradle-update
Implement grade and new GHA release
- Loading branch information
Showing
14 changed files
with
618 additions
and
341 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
name: Create Release Version & Publish Package | ||
|
||
on: | ||
push: | ||
branches: [main] | ||
|
||
jobs: | ||
release_on_push: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- uses: actions/setup-java@v3 | ||
with: | ||
java-version: '11' | ||
distribution: 'adopt' | ||
cache: gradle | ||
|
||
- name: Validate Gradle wrapper | ||
uses: gradle/wrapper-validation-action@v1 | ||
|
||
- name: Test & Build | ||
uses: gradle/gradle-build-action@v2 | ||
with: | ||
arguments: clean build -x assemble -x shadowJar | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Create release | ||
id: release | ||
uses: rymndhng/[email protected] | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
bump_version_scheme: norelease | ||
tag_prefix: '' | ||
release_name: "Release <RELEASE_VERSION>" | ||
use_github_release_notes: true | ||
|
||
- name: Publish package | ||
uses: gradle/gradle-build-action@v2 | ||
with: | ||
arguments: publish | ||
env: | ||
GITHUB_VERSION: ${{ steps.release.outputs.tag_name }} | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Upload release artifact | ||
uses: svenstaro/upload-release-action@v2 | ||
with: | ||
repo_token: ${{ secrets.GITHUB_TOKEN }} | ||
file: build/libs/multiverse-inventories-${{ steps.release.outputs.tag_name }}.jar | ||
asset_name: multiverse-inventories-${{ steps.release.outputs.tag_name }}.jar | ||
tag: ${{ steps.release.outputs.tag_name }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
name: Require PR Labels | ||
|
||
on: | ||
pull_request: | ||
types: [opened, labeled, unlabeled, synchronize] | ||
branches: [main] | ||
|
||
jobs: | ||
require_label: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: mheap/github-action-required-labels@v2 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
mode: exactly | ||
count: 1 | ||
labels: "release:major, release:minor, release:patch, no release" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
name: Run unit tests against all PRs | ||
|
||
on: | ||
pull_request: | ||
types: [opened, synchronize] | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- uses: actions/setup-java@v3 | ||
with: | ||
java-version: '11' | ||
distribution: 'adopt' | ||
cache: gradle | ||
|
||
- name: Validate Gradle wrapper | ||
uses: gradle/wrapper-validation-action@v1 | ||
|
||
- name: Run unit tests | ||
uses: gradle/gradle-build-action@v2 | ||
with: | ||
arguments: build | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -43,3 +43,7 @@ debug.log | |
# Doxygen | ||
/docs/html | ||
debug.txt | ||
|
||
# Gradle | ||
.gradle | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,159 @@ | ||
plugins { | ||
id 'java-library' | ||
id 'maven-publish' | ||
id 'checkstyle' | ||
id 'com.github.johnrengelman.shadow' version '7.1.2' | ||
} | ||
|
||
version = System.getenv('GITHUB_VERSION') ?: 'local' | ||
group = 'com.onarandombox.multiverseinventories' | ||
description = 'Multiverse-Inventories' | ||
|
||
java.sourceCompatibility = JavaVersion.VERSION_11 | ||
|
||
repositories { | ||
mavenLocal() | ||
mavenCentral() | ||
|
||
maven { | ||
name = 'onarandombox' | ||
url = uri('https://repo.onarandombox.com/content/groups/public') | ||
} | ||
|
||
maven { | ||
name ='papermc' | ||
url = uri('https://papermc.io/repo/repository/maven-public/') | ||
} | ||
|
||
maven { | ||
name = 'jitpack.io' | ||
url = uri('https://jitpack.io/') | ||
} | ||
} | ||
|
||
dependencies { | ||
// Spigot | ||
implementation('org.bukkit:bukkit:1.14.4-R0.1-SNAPSHOT') { | ||
exclude group: 'junit', module: 'junit' | ||
} | ||
|
||
// Core | ||
implementation('com.onarandombox.multiversecore:Multiverse-Core:4.2.2') { | ||
exclude group: 'me.main__.util', module: 'SerializationConfig' | ||
} | ||
|
||
// Config | ||
api 'com.dumptruckman.minecraft:JsonConfiguration:1.1' | ||
api ('com.googlecode.json-simple:json-simple:1.1.1') { | ||
exclude group: 'junit', module: 'junit' | ||
} | ||
|
||
// Utils | ||
api 'io.papermc:paperlib:1.0.7' | ||
api('com.dumptruckman.minecraft:Logging:1.1.1') { | ||
exclude group: 'junit', module: 'junit' | ||
} | ||
|
||
// Other plugins for import | ||
implementation('uk.co:MultiInv:3.0.6') { | ||
exclude group: '*', module: '*' | ||
} | ||
implementation('me.drayshak:WorldInventories:1.0.2') { | ||
exclude group: '*', module: '*' | ||
} | ||
|
||
// Legacy Multiverse-Adventure | ||
implementation('com.onarandombox.multiverseadventure:Multiverse-Adventure:2.5.0-SNAPSHOT') { | ||
exclude group: '*', module: '*' | ||
} | ||
|
||
// Tests | ||
testImplementation 'com.github.MilkBowl:VaultAPI:1.7.1' | ||
testImplementation 'junit:junit:4.13.2' | ||
testImplementation 'org.mockito:mockito-core:3.11.2' | ||
} | ||
|
||
|
||
java { | ||
withSourcesJar() | ||
withJavadocJar() | ||
} | ||
|
||
tasks.withType(JavaCompile).configureEach { | ||
options.encoding = 'UTF-8' | ||
} | ||
|
||
tasks.withType(Javadoc).configureEach { | ||
options.encoding = 'UTF-8' | ||
} | ||
|
||
|
||
configurations { | ||
[apiElements, runtimeElements].each { | ||
it.outgoing.artifacts.removeIf { it.buildDependencies.getDependencies(null).contains(jar) } | ||
it.outgoing.artifact(shadowJar) | ||
} | ||
} | ||
|
||
publishing { | ||
publications { | ||
maven(MavenPublication) { | ||
from components.java | ||
} | ||
} | ||
repositories { | ||
maven { | ||
name = "GitHubPackages" | ||
url = "https://maven.pkg.github.com/Multiverse/Multiverse-Inventories" | ||
credentials { | ||
username = System.getenv("GITHUB_ACTOR") | ||
password = System.getenv("GITHUB_TOKEN") | ||
} | ||
} | ||
} | ||
} | ||
|
||
|
||
processResources { | ||
def props = [version: "${project.version}"] | ||
inputs.properties props | ||
filteringCharset 'UTF-8' | ||
filesMatching('plugin.yml') { | ||
expand props | ||
} | ||
|
||
// This task should never be skipped. The tests depend on this having been run but we want the new version number | ||
// that is created after tests are run and before we run again to publish. | ||
outputs.upToDateWhen { false } | ||
} | ||
|
||
|
||
checkstyle { | ||
toolVersion = '6.1.1' | ||
configFile file('config/mv_checks.xml') | ||
ignoreFailures = true | ||
} | ||
|
||
|
||
javadoc { | ||
source = sourceSets.main.allJava | ||
classpath = configurations.compileClasspath | ||
} | ||
|
||
|
||
project.configurations.api.canBeResolved = true | ||
|
||
shadowJar { | ||
relocate 'com.dumptruckman.minecraft.util.Logging', 'com.onarandombox.multiverseinventories.utils.InvLogging' | ||
relocate 'com.dumptruckman.minecraft.util.DebugLog', 'com.onarandombox.multiverseinventories.utils.DebugFileLogger' | ||
relocate 'com.dumptruckman.bukkit.configuration', 'com.onarandombox.multiverseinventories.utils.configuration' | ||
relocate 'io.papermc.lib', 'com.onarandombox.multiverseinventories.utils.paperlib' | ||
relocate 'net.minidev.json', 'com.onarandombox.multiverseinventories.utils.json' | ||
|
||
configurations = [project.configurations.api] | ||
|
||
archiveFileName = "$baseName-$version.$extension" | ||
} | ||
|
||
build.dependsOn shadowJar | ||
jar.enabled = false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip | ||
networkTimeout=10000 | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists |
Oops, something went wrong.