From a6279f9a7ae65999029434b5c6bfba557e2b77fe Mon Sep 17 00:00:00 2001 From: Justin Abrahms Date: Fri, 29 Apr 2022 13:53:30 -0700 Subject: [PATCH] Fix pr builds --- .github/workflows/build.yml | 22 ++++++++++++++++ .github/workflows/{gradle.yml => merge.yml} | 16 +++--------- .github/workflows/pullrequest.yml | 25 +++++++++++++++++++ .../{gradle-publish.yml => release.yml} | 18 +++---------- 4 files changed, 53 insertions(+), 28 deletions(-) create mode 100644 .github/workflows/build.yml rename .github/workflows/{gradle.yml => merge.yml} (76%) create mode 100644 .github/workflows/pullrequest.yml rename .github/workflows/{gradle-publish.yml => release.yml} (67%) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 00000000..3b04b8b7 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,22 @@ +name: Build + +on: + workflow_call: + + +permissions: + contents: read + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Set up JDK 8 + uses: actions/setup-java@v3 + with: + java-version: '8' + distribution: 'temurin' + - name: Build with Gradle + uses: gradle/gradle-build-action@0d13054264b0bb894ded474f08ebb30921341cee + with: + arguments: build \ No newline at end of file diff --git a/.github/workflows/gradle.yml b/.github/workflows/merge.yml similarity index 76% rename from .github/workflows/gradle.yml rename to .github/workflows/merge.yml index 8ae18d64..8ed642c7 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/merge.yml @@ -5,7 +5,7 @@ # This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time # For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle -name: Java CI with Gradle +name: Build & Snapshot publishing on: push: @@ -24,20 +24,10 @@ jobs: steps: - uses: actions/checkout@v3 - - name: Set up JDK 8 - uses: actions/setup-java@v3 - with: - java-version: '8' - distribution: 'temurin' - - name: Build with Gradle - uses: gradle/gradle-build-action@0d13054264b0bb894ded474f08ebb30921341cee - with: - arguments: build - - + - uses: ./.github/workflows/build.yml@main # The USERNAME and TOKEN need to correspond to the credentials environment variables used in # the publishing section of your build.gradle - - name: Publish to GitHub Packages + - name: Publish to Sonatype (Maven) uses: gradle/gradle-build-action@0d13054264b0bb894ded474f08ebb30921341cee with: arguments: publish -PossrhUsername=${{ secrets.OSSRH_USERNAME }} -PossrhPassword=${{ secrets.OSSRH_PASSWORD }} diff --git a/.github/workflows/pullrequest.yml b/.github/workflows/pullrequest.yml new file mode 100644 index 00000000..31fe0c23 --- /dev/null +++ b/.github/workflows/pullrequest.yml @@ -0,0 +1,25 @@ +# This workflow uses actions that are not certified by GitHub. +# They are provided by a third-party and are governed by +# separate terms of service, privacy policy, and support +# documentation. +# This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time +# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle + +name: Gradle PR + +on: + pull_request: + branches: [ master, main ] + +permissions: + packages: write + contents: read + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + - uses: ./.github/workflows/build.yml@main \ No newline at end of file diff --git a/.github/workflows/gradle-publish.yml b/.github/workflows/release.yml similarity index 67% rename from .github/workflows/gradle-publish.yml rename to .github/workflows/release.yml index 40fdacdc..3956bdf9 100644 --- a/.github/workflows/gradle-publish.yml +++ b/.github/workflows/release.yml @@ -5,7 +5,7 @@ # 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/blob/main/docs/advanced-usage.md#Publishing-using-gradle -name: Gradle Package +name: Build & Package on: release: @@ -21,22 +21,10 @@ jobs: steps: - uses: actions/checkout@v3 - - name: Set up JDK 8 - uses: actions/setup-java@v3 - with: - java-version: '8' - distribution: 'temurin' - 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 - uses: gradle/gradle-build-action@0d13054264b0bb894ded474f08ebb30921341cee - with: - arguments: build - + - uses: ./.github/workflows/build.yml@main # The USERNAME and TOKEN need to correspond to the credentials environment variables used in # the publishing section of your build.gradle - - name: Publish to GitHub Packages + - name: Publish to Sonatype (Maven) uses: gradle/gradle-build-action@0d13054264b0bb894ded474f08ebb30921341cee with: arguments: publish -PossrhUsername=${{ secrets.OSSRH_USERNAME }} -PossrhPassword=${{ secrets.OSSRH_PASSWORD }}