From fa7693528fd5fdafa81ffd17841353109d24a63f Mon Sep 17 00:00:00 2001 From: LMBishop <13875753+LMBishop@users.noreply.github.com> Date: Thu, 10 Jun 2021 14:01:52 +0100 Subject: Add publishing --- .github/workflows/build.yml | 4 ++-- .github/workflows/publish.yml | 22 ++++++++++++++++++++++ build.gradle | 25 ++++++++++++++++++++++++- 3 files changed, 48 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 16a80b27..087fff2b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,4 +1,4 @@ -name: Build Plugin +name: Build plugin on: ["pull_request", "push"] @@ -37,4 +37,4 @@ jobs: uses: actions/upload-artifact@master with: name: Quests-JDK${{ matrix.java }} - path: build/libs/*.jar \ No newline at end of file + path: build/libs/*.jar diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index e69de29b..ffc22cbd 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -0,0 +1,22 @@ +name: Publish plugin to repository +on: + release: + types: [created] +jobs: + publish: + runs-on: ubuntu-18.04 + permissions: + contents: read + packages: write + steps: + - uses: actions/checkout@v2 + - name: Set up Java + uses: actions/setup-java@v2 + with: + java-version: '1.8' + distribution: 'adopt' + - name: Publish to repository + run: gradle publish + env: + MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }} + MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }} diff --git a/build.gradle b/build.gradle index fa087695..a4cf2ad9 100644 --- a/build.gradle +++ b/build.gradle @@ -1,6 +1,7 @@ plugins { id 'java' id 'com.github.johnrengelman.shadow' version '6.1.0' + id 'maven-publish' } group = 'com.leonardobishop' @@ -98,7 +99,29 @@ shadowJar { archiveClassifier.set('') } -jar.enabled = false +publishing { + publications { + maven(MavenPublication) { + groupId = 'com.leonardobishop' + artifactId = 'quests' + version = project.version + + from components.java + } + } + + repositories { + maven { + credentials { + username = project.findProperty('mavenUser') ?: System.getenv('MAVEN_USER') + password = project.findProperty('mavenPassword') ?: System.getenv('MAVEN_PASSWORD') + } + url = "https://repo.leonardobishop.com/releases/" + } + } +} + +jar.enabled = true tasks.build { dependsOn(tasks.shadowJar) -- cgit v1.2.3-70-g09d2