diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml new file mode 100644 index 000000000..fc4a1c8ee --- /dev/null +++ b/.github/workflows/maven.yml @@ -0,0 +1,30 @@ +# This workflow will build a Java project with Gradle +# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle + +name: Publish package to the Maven Central Repository +on: + release: + types: [published] + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: Set up JDK 8 + uses: actions/setup-java@v2 + with: + java-version: '8' + distribution: 'adopt' + - name: Grant execute permission for gradlew + run: chmod +x gradlew + - name: Build with Gradle + run: ./gradlew build + - name: Publish + run: ./gradlew artifactoryPublish + env: + MAVEN_URL: ${{ secrets.MAVEN_URL }} + MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }} + MAVEN_PASSWORD: ${{ secrets.MAVEN_TOKEN }} diff --git a/.gitignore b/.gitignore index c2d0efed6..104519877 100644 --- a/.gitignore +++ b/.gitignore @@ -21,4 +21,5 @@ MDK.zip *.mtl *.blend1 *.blend2 -/bin \ No newline at end of file +/bin +gradle.properties diff --git a/build.gradle b/build.gradle index 5623178f5..56b987845 100644 --- a/build.gradle +++ b/build.gradle @@ -11,7 +11,7 @@ buildscript { classpath ('com.anatawa12.forge:ForgeGradle:1.2-1.0.+') { changing = true } - classpath "org.jfrog.buildinfo:build-info-extractor-gradle:4.27.1" + classpath "org.jfrog.buildinfo:build-info-extractor-gradle:latest.release" } } @@ -175,3 +175,58 @@ task fullBuild(type: Delete) { fullBuild.dependsOn('releaseJars') +artifactory { + contextUrl = System.getenv("MAVEN_URL") + publish { + repository { + repoKey = 'thorfusion' + username = System.getenv("MAVEN_USERNAME") + password = System.getenv("MAVEN_PASSWORD") + maven = true + } + defaults { + publications('mavenJava') + } + publishBuildInfo = false + publishArtifacts = true + publishPom = true + } + resolve { + repository { + repoKey = 'central' + username = System.getenv("MAVEN_USERNAME") + password = System.getenv("MAVEN_PASSWORD") + maven = true + + } + } +} + +publishing { + publications { + mavenJava(MavenPublication) { + from components.java + artifactId = rootProject.name + groupId = project.group + version = project.version + artifacts = [coreJar, toolsJar, generatorsJar, MDKZip, alltJar] + pom { + name.set("Mekanism Community Edition") + packaging = 'jar' + description.set('Mekanism is a Minecraft add-on featuring high-tech machinery that can be used to create powerful tools, armor, and weapons.') + url.set('https://aidancbrady.com/mekanism/') + issueManagement { + system.set('github') + url.set('https://github.com/Thorfusion/Mekanism-1.7.10-Community-Edition/issues') + } + licenses { + license { + name.set('CC BY-NC-SA 4.0') + distribution.set('repo') + } + } + } + } + } +} +