diff --git a/.github/actions/build/action.yml b/.github/actions/build/action.yml new file mode 100644 index 0000000..7e0c398 --- /dev/null +++ b/.github/actions/build/action.yml @@ -0,0 +1,32 @@ +name: Build +description: Builds and captures the compiled jar + +inputs: + capture-artifacts: + description: Should artifacts be captured + required: false + default: true + +runs: + using: composite + steps: + - name: Validate Gradle Wrapper + uses: gradle/wrapper-validation-action@v1 + - name: Set up JDK 17 + uses: actions/setup-java@v3 + with: + java-version: 17 + distribution: 'temurin' + - name: Make Gradle Wrapper executable + if: ${{ runner.os != 'Windows' }} + run: chmod +x ./gradlew + shell: bash + - name: Build + run: ./gradlew build + shell: bash + - name: Capture build artifacts + if: ${{ inputs.capture-artifacts }} + uses: actions/upload-artifact@v3 + with: + name: Artifacts + path: build/libs/ diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml deleted file mode 100644 index 820f211..0000000 --- a/.github/workflows/build.yml +++ /dev/null @@ -1,25 +0,0 @@ -name: build -on: [pull_request, push] - -jobs: - build: - runs-on: ubuntu-22.04 - steps: - - name: Checkout repository - uses: actions/checkout@v3 - - name: Validate Gradle wrapper - uses: gradle/wrapper-validation-action@v1 - - name: Set-up JDK 17 - uses: actions/setup-java@v3 - with: - java-version: 17 - distribution: 'temurin' - - name: Make Gradle wrapper executable - run: chmod +x ./gradlew - - name: Build - run: ./gradlew build - - name: Capture build artifacts - uses: actions/upload-artifact@v3 - with: - name: Artifacts - path: build/libs/ diff --git a/.github/workflows/pull-build b/.github/workflows/pull-build new file mode 100644 index 0000000..f491914 --- /dev/null +++ b/.github/workflows/pull-build @@ -0,0 +1,11 @@ +name: Build on pull +on: pull_request + +jobs: + build: + runs-on: ubuntu-22.04 + steps: + - name: Checkout repository + uses: actions/checkout@v3 + - name: Build and capture artifacts + uses: ./.github/actions/build diff --git a/.github/workflows/push-build.yml b/.github/workflows/push-build.yml new file mode 100644 index 0000000..72a21fc --- /dev/null +++ b/.github/workflows/push-build.yml @@ -0,0 +1,11 @@ +name: Build on push +on: push + +jobs: + build: + runs-on: ubuntu-22.04 + steps: + - name: Checkout repository + uses: actions/checkout@v3 + - name: Build and capture artifacts + uses: ./.github/actions/build