From 4297db3805c05b2400be393954c7a49447482f5b Mon Sep 17 00:00:00 2001 From: Jason Penilla <11360596+jpenilla@users.noreply.github.com> Date: Mon, 12 Feb 2024 16:10:19 -0700 Subject: [PATCH 1/4] Setup publishing --- .github/workflows/build.yml | 39 +++++++++++++++++++++++++++---------- build.gradle.kts | 3 +++ 2 files changed, 32 insertions(+), 10 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 94047f8..a85a165 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -15,13 +15,32 @@ jobs: java: [ 17 ] fail-fast: true steps: - - uses: actions/checkout@v4 - - uses: gradle/wrapper-validation-action@v2 - - name: JDK ${{ matrix.java }} - uses: actions/setup-java@v4 - with: - java-version: ${{ matrix.java }} - distribution: 'temurin' - - uses: gradle/actions/setup-gradle@v3 - - name: Build - run: ./gradlew build --stacktrace + - uses: actions/checkout@v4 + - uses: gradle/wrapper-validation-action@v2 + - name: JDK ${{ matrix.java }} + uses: actions/setup-java@v4 + with: + java-version: ${{ matrix.java }} + distribution: 'temurin' + - uses: gradle/actions/setup-gradle@v3 + - name: Build + run: ./gradlew build --stacktrace + - name: Determine Status + run: | + if [ "$(./gradlew properties | awk '/^version:/ { print $2; }' | grep '\-SNAPSHOT')" ]; then + echo "STATUS=snapshot" >> $GITHUB_ENV + else + echo "STATUS=release" >> $GITHUB_ENV + fi + - name: Publish Snapshot + if: "${{ env.STATUS != 'release' && github.event_name == 'push' && github.ref == 'refs/heads/main' }}" + run: ./gradlew publish + env: + ORG_GRADLE_PROJECT_paperUsername: "${{ secrets.PAPER_REPO_USER }}" + ORG_GRADLE_PROJECT_paperPassword: "${{ secrets.PAPER_REPO_PASSWORD }}" + - name: Publish Release + if: "${{ env.STATUS == 'release' && github.event_name == 'release' }}" + run: ./gradlew publish + env: + ORG_GRADLE_PROJECT_paperUsername: "${{ secrets.PAPER_REPO_USER }}" + ORG_GRADLE_PROJECT_paperPassword: "${{ secrets.PAPER_REPO_PASSWORD }}" diff --git a/build.gradle.kts b/build.gradle.kts index f9f4fa4..78d277b 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -14,6 +14,9 @@ allprojects { javaVersions { target(17) } + + publishSnapshotsTo("paperSnapshots", "https://repo.papermc.io/repository/maven-snapshots/") + publishReleasesTo("paperReleases", "https://repo.papermc.io/repository/maven-releases/") } repositories { From 562d3a7596e04f7d575b2bf6775246f99397e58e Mon Sep 17 00:00:00 2001 From: Jason Penilla <11360596+jpenilla@users.noreply.github.com> Date: Mon, 12 Feb 2024 16:21:42 -0700 Subject: [PATCH 2/4] Populate pom --- build.gradle.kts | 27 +++++++++++++++++++++++++++ gradle.properties | 1 + 2 files changed, 28 insertions(+) diff --git a/build.gradle.kts b/build.gradle.kts index 78d277b..e3a33a2 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,8 +1,11 @@ +import org.incendo.cloudbuildlogic.jmp + plugins { val indraVer = "3.1.3" id("net.kyori.indra") version indraVer id("net.kyori.indra.checkstyle") version indraVer id("net.kyori.indra.publishing") version indraVer + id("org.incendo.cloud-build-logic") version "0.0.12" apply false } allprojects { @@ -17,6 +20,30 @@ allprojects { publishSnapshotsTo("paperSnapshots", "https://repo.papermc.io/repository/maven-snapshots/") publishReleasesTo("paperReleases", "https://repo.papermc.io/repository/maven-releases/") + + apache2License() + + github("PaperMC", "asm-utils") { + ci(true) + } + + configurePublications { + pom { + developers { + jmp() + developer { + id = "Machine-Maker" + name = "Jake Potrebic" + url = "https://github.com/Machine-Maker" + } + developer { + id = "kennytv" + name = "Nassim Jahnke" + url = "https://github.com/kennytv" + } + } + } + } } repositories { diff --git a/gradle.properties b/gradle.properties index a67330c..cbf89f9 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,6 +1,7 @@ # project meta group=io.papermc version=0.0.1-SNAPSHOT +description=Shared ASM utilities for PaperMC projects # gradle options org.gradle.caching=true From 2f06737331fa2ec068a82ee1dc5bf96df2129aa2 Mon Sep 17 00:00:00 2001 From: Jason Penilla <11360596+jpenilla@users.noreply.github.com> Date: Mon, 12 Feb 2024 16:58:35 -0700 Subject: [PATCH 3/4] Setup javadoc linking --- build.gradle.kts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle.kts b/build.gradle.kts index e3a33a2..4f6c7c3 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -5,7 +5,7 @@ plugins { id("net.kyori.indra") version indraVer id("net.kyori.indra.checkstyle") version indraVer id("net.kyori.indra.publishing") version indraVer - id("org.incendo.cloud-build-logic") version "0.0.12" apply false + id("org.incendo.cloud-build-logic.javadoc-links") version "0.0.12" } allprojects { From f6909cd7503ba42a3080b2516fcc84a31b7afd5a Mon Sep 17 00:00:00 2001 From: Jason Penilla <11360596+jpenilla@users.noreply.github.com> Date: Mon, 12 Feb 2024 17:00:33 -0700 Subject: [PATCH 4/4] Reformat actions config --- .editorconfig | 3 ++ .github/workflows/build.yml | 84 ++++++++++++++++++------------------- 2 files changed, 45 insertions(+), 42 deletions(-) diff --git a/.editorconfig b/.editorconfig index 315b30a..cd2670c 100644 --- a/.editorconfig +++ b/.editorconfig @@ -6,3 +6,6 @@ indent_size = 4 indent_style = space insert_final_newline = true max_line_length = off + +[*.yml] +indent_size = 2 diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a85a165..6c4fd65 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,46 +1,46 @@ name: Build on: - push: - branches: [ "**" ] - tags-ignore: [ "**" ] - pull_request: + push: + branches: [ "**" ] + tags-ignore: [ "**" ] + pull_request: jobs: - build: - # Only run on PRs if the source branch is on someone else's repo - if: ${{ github.event_name != 'pull_request' || github.repository != github.event.pull_request.head.repo.full_name }} - runs-on: ubuntu-latest - strategy: - matrix: - java: [ 17 ] - fail-fast: true - steps: - - uses: actions/checkout@v4 - - uses: gradle/wrapper-validation-action@v2 - - name: JDK ${{ matrix.java }} - uses: actions/setup-java@v4 - with: - java-version: ${{ matrix.java }} - distribution: 'temurin' - - uses: gradle/actions/setup-gradle@v3 - - name: Build - run: ./gradlew build --stacktrace - - name: Determine Status - run: | - if [ "$(./gradlew properties | awk '/^version:/ { print $2; }' | grep '\-SNAPSHOT')" ]; then - echo "STATUS=snapshot" >> $GITHUB_ENV - else - echo "STATUS=release" >> $GITHUB_ENV - fi - - name: Publish Snapshot - if: "${{ env.STATUS != 'release' && github.event_name == 'push' && github.ref == 'refs/heads/main' }}" - run: ./gradlew publish - env: - ORG_GRADLE_PROJECT_paperUsername: "${{ secrets.PAPER_REPO_USER }}" - ORG_GRADLE_PROJECT_paperPassword: "${{ secrets.PAPER_REPO_PASSWORD }}" - - name: Publish Release - if: "${{ env.STATUS == 'release' && github.event_name == 'release' }}" - run: ./gradlew publish - env: - ORG_GRADLE_PROJECT_paperUsername: "${{ secrets.PAPER_REPO_USER }}" - ORG_GRADLE_PROJECT_paperPassword: "${{ secrets.PAPER_REPO_PASSWORD }}" + build: + # Only run on PRs if the source branch is on someone else's repo + if: ${{ github.event_name != 'pull_request' || github.repository != github.event.pull_request.head.repo.full_name }} + runs-on: ubuntu-latest + strategy: + matrix: + java: [ 17 ] + fail-fast: true + steps: + - uses: actions/checkout@v4 + - uses: gradle/wrapper-validation-action@v2 + - name: JDK ${{ matrix.java }} + uses: actions/setup-java@v4 + with: + java-version: ${{ matrix.java }} + distribution: 'temurin' + - uses: gradle/actions/setup-gradle@v3 + - name: Build + run: ./gradlew build --stacktrace + - name: Determine Status + run: | + if [ "$(./gradlew properties | awk '/^version:/ { print $2; }' | grep '\-SNAPSHOT')" ]; then + echo "STATUS=snapshot" >> $GITHUB_ENV + else + echo "STATUS=release" >> $GITHUB_ENV + fi + - name: Publish Snapshot + if: "${{ env.STATUS != 'release' && github.event_name == 'push' && github.ref == 'refs/heads/main' }}" + run: ./gradlew publish + env: + ORG_GRADLE_PROJECT_paperUsername: "${{ secrets.PAPER_REPO_USER }}" + ORG_GRADLE_PROJECT_paperPassword: "${{ secrets.PAPER_REPO_PASSWORD }}" + - name: Publish Release + if: "${{ env.STATUS == 'release' && github.event_name == 'release' }}" + run: ./gradlew publish + env: + ORG_GRADLE_PROJECT_paperUsername: "${{ secrets.PAPER_REPO_USER }}" + ORG_GRADLE_PROJECT_paperPassword: "${{ secrets.PAPER_REPO_PASSWORD }}"