diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..91a0808 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,29 @@ +# Automatically build the project and run any configured tests for every push +# and submitted pull request. This can help catch issues that only occur on +# certain platforms or Java versions, and provides a first line of defence +# against bad commits. + +name: Java CI +on: [pull_request, push] + +jobs: + build: + strategy: + matrix: + os: [ubuntu-latest, windows-latest] + java: [18] + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v3 + - name: Set up JDK + uses: actions/setup-java@v3 + with: + java-version: ${{ matrix.java }} + distribution: 'adopt' + - name: Make gradle wrapper executable + if: ${{ runner.os != 'Windows' }} + run: chmod +x ./gradlew + - name: Build + uses: gradle/gradle-build-action@67421db6bd0bf253fb4bd25b31ebb98943c375e1 + with: + arguments: build diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..2b26280 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,27 @@ +# Automatically publish the project to GitHub Packages for every published release. + +name: Publish to GitHub Packages +on: + release: + types: [published] + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Set up JDK + uses: actions/setup-java@v3 + with: + java-version: '18' + distribution: 'adopt' + - name: Make gradle wrapper executable + if: ${{ runner.os != 'Windows' }} + run: chmod +x ./gradlew + - name: Publish package + uses: gradle/gradle-build-action@v2 + with: + arguments: publish + env: + GITHUB_ACTOR: ${{ github.actor }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/build.gradle b/build.gradle index 941fced..e1560e3 100644 --- a/build.gradle +++ b/build.gradle @@ -1,5 +1,6 @@ plugins { id 'java' + id 'maven-publish' id 'com.github.johnrengelman.shadow' version '7.0.0' } @@ -16,7 +17,6 @@ repositories { } configurations { - include include.canBeResolved = true compileOnly.extendsFrom(include) } @@ -31,6 +31,8 @@ build { shadowJar { configurations = [project.configurations.include] + + archiveFileName = "${archivesBaseName}-${version}.jar" } tasks.withType(JavaCompile).configureEach { @@ -45,3 +47,21 @@ processResources { ) } } + +publishing { + publications { + maven(MavenPublication) { + from components.java + } + } + repositories { + maven { + name = "GitHubPackages" + url = "https://maven.pkg.github.com/PeaceAndCubeMC/PACFirstPlayed" + credentials { + username = System.getenv("GITHUB_ACTOR") + password = System.getenv("GITHUB_TOKEN") + } + } + } +} diff --git a/gradle.properties b/gradle.properties index dbee75f..eeb1379 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,5 +1,5 @@ pacfirstplayed_group = fr.peaceandcube pacfirstplayed_name = pacfirstplayed -pacfirstplayed_version = 1.3.0 +pacfirstplayed_version = 1.3.1-SNAPSHOT paper_version = 1.19.4-R0.1-SNAPSHOT diff --git a/settings.gradle b/settings.gradle index 0f82d16..54b79f5 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,2 +1,2 @@ -rootProject.name = 'PACFirstPlayed' +rootProject.name = 'pacfirstplayed'