diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml new file mode 100644 index 0000000..495f9cd --- /dev/null +++ b/.github/workflows/gradle.yml @@ -0,0 +1,19 @@ +name: Java CI + +on: [push] + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: Set up JDK 11 + uses: actions/setup-java@v1 + with: + java-version: 11 + - name: Grant execute permission for gradlew + run: chmod +x gradlew + - name: Build with Gradle + run: ./gradlew build diff --git a/.github/workflows/gradlepublish.yml b/.github/workflows/gradlepublish.yml new file mode 100644 index 0000000..d617d06 --- /dev/null +++ b/.github/workflows/gradlepublish.yml @@ -0,0 +1,33 @@ +# This workflow will build a package using Gradle and then publish it to GitHub packages when a release is created +# For more information see: https://github.com/actions/setup-java#publishing-using-gradle + +name: Publish Package + +on: + release: + types: [created] + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: Set up JDK 11 + uses: actions/setup-java@v1 + with: + java-version: 11 + server-id: github # Value of the distributionManagement/repository/id field of the pom.xml + settings-path: ${{ github.workspace }} # location for the settings.xml file + + - name: Build with Gradle + run: gradle build + + # The USERNAME and PASSWORD need to correspond to the credentials environment variables used in + # the publishing section of your build.gradle + - name: Publish to GitHub Packages + run: gradle publish + env: + USERNAME: ${{ github.actor }} + PASSWORD: ${{ secrets.GITHUB_TOKEN }} diff --git a/build.gradle b/build.gradle index b368e84..9455ec5 100644 --- a/build.gradle +++ b/build.gradle @@ -1,10 +1,30 @@ apply plugin: 'java' +apply plugin: 'maven' +apply plugin: 'maven-publish' group 'com.panguengine' version '1.0.0' sourceCompatibility = targetCompatibility = 11 +publishing { + repositories { + maven { + name = "GitHubPackages" + url = uri("https://maven.pkg.github.com/UnknownDomainGame/PBDF") + credentials { + username = project.findProperty("gpr.user") ?: System.getenv("USERNAME") + password = project.findProperty("gpr.key") ?: System.getenv("PASSWORD") + } + } + } + publications { + gpr(MavenPublication) { + from(components.java) + } + } +} + repositories { jcenter() mavenCentral()