From 820eecf8662b70e38903d4f325597ea1d3bd7322 Mon Sep 17 00:00:00 2001 From: Rahul Somasunderam Date: Sat, 7 Jan 2023 16:52:17 -0800 Subject: [PATCH] chore: Use reusable workflow --- .github/workflows/build-master.yml | 43 ---------------- .github/workflows/build-pr.yml | 71 --------------------------- .github/workflows/build-tag-final.yml | 45 ----------------- .github/workflows/build-tag-rc.yml | 45 ----------------- .github/workflows/build.yml | 18 +++++++ 5 files changed, 18 insertions(+), 204 deletions(-) delete mode 100644 .github/workflows/build-master.yml delete mode 100644 .github/workflows/build-pr.yml delete mode 100644 .github/workflows/build-tag-final.yml delete mode 100644 .github/workflows/build-tag-rc.yml create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build-master.yml b/.github/workflows/build-master.yml deleted file mode 100644 index 77c91df..0000000 --- a/.github/workflows/build-master.yml +++ /dev/null @@ -1,43 +0,0 @@ -name: Build Master - -on: - push: - branches: [ master ] - -jobs: - build: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v3 - - - name: Cache Gradle Caches - id: cache-gradle-caches - uses: actions/cache@v3 - with: - key: ${{ runner.os }}-${{hashFiles('**/*.gradle')}} - path: | - ~/.gradle/caches - - name: Cache Gradle Wrapper - id: cache-gradle-wrapper - uses: actions/cache@v3 - with: - key: ${{ runner.os }}-gradle-wrapper-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }} - path: | - ~/.gradle/wrapper - - uses: gradle/wrapper-validation-action@v1 - name: Validate Gradle Wrapper - - - name: Set up JDK 17 - uses: actions/setup-java@v3 - with: - java-version: 17 - distribution: zulu - - - name: Build with Gradle - env: - ORG_GRADLE_PROJECT_sonatypeUsername: rahulsom - ORG_GRADLE_PROJECT_sonatypePassword: ${{secrets.ORG_GRADLE_PROJECT_sonatypePassword}} - ORG_GRADLE_PROJECT_signingKey: ${{secrets.ORG_GRADLE_PROJECT_signingKey}} - ORG_GRADLE_PROJECT_signingPassword: ${{secrets.ORG_GRADLE_PROJECT_signingPassword}} - run: ./gradlew build snapshot --stacktrace --parallel diff --git a/.github/workflows/build-pr.yml b/.github/workflows/build-pr.yml deleted file mode 100644 index 90f14a8..0000000 --- a/.github/workflows/build-pr.yml +++ /dev/null @@ -1,71 +0,0 @@ -name: Build PR - -on: - pull_request: - branches: [ master ] - -jobs: - build: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v3 - - - name: Cache Gradle Caches - id: cache-gradle-caches - uses: actions/cache@v3 - with: - key: ${{ runner.os }}-${{hashFiles('**/*.gradle')}} - path: | - ~/.gradle/caches - - name: Cache Gradle Wrapper - id: cache-gradle-wrapper - uses: actions/cache@v3 - with: - key: ${{ runner.os }}-gradle-wrapper-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }} - path: | - ~/.gradle/wrapper - - uses: gradle/wrapper-validation-action@v1 - name: Validate Gradle Wrapper - - - name: Set up JDK 17 - uses: actions/setup-java@v3 - with: - java-version: 17 - distribution: zulu - - - name: Build with Gradle - run: ./gradlew check build --stacktrace --parallel - - - id: get-comment-body - if: always() - run: | - body=$(cat build/gradle-scan.md) - body="${body//'%'/'%25'}" - body="${body//$'\n'/'%0A'}" - body="${body//$'\r'/'%0D'}" - echo ::set-output name=body::$body - - - name: Find Comment - uses: peter-evans/find-comment@v2 - if: always() - id: fc - with: - issue-number: ${{ github.event.pull_request.number }} - comment-author: 'github-actions[bot]' - body-includes: Gradle Build Scan - - - name: Create or update comment - uses: peter-evans/create-or-update-comment@v2 - if: always() - with: - comment-id: ${{ steps.fc.outputs.comment-id }} - issue-number: ${{ github.event.pull_request.number }} - body: ${{ steps.get-comment-body.outputs.body }} - edit-mode: replace - - - name: Publish Test Report - uses: mikepenz/action-junit-report@v3 - if: always() - with: - report_paths: '**/build/test-results/test/TEST-*.xml' diff --git a/.github/workflows/build-tag-final.yml b/.github/workflows/build-tag-final.yml deleted file mode 100644 index fe4a2d5..0000000 --- a/.github/workflows/build-tag-final.yml +++ /dev/null @@ -1,45 +0,0 @@ -name: Build Final Release - -on: - push: - tags: - - v[0-9]+.[0-9]+.[0-9]+ - -jobs: - build: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v3 - - - name: Cache Gradle Caches - id: cache-gradle-caches - uses: actions/cache@v3 - with: - key: ${{ runner.os }}-${{hashFiles('**/*.gradle')}} - path: | - ~/.gradle/caches - - name: Cache Gradle Wrapper - id: cache-gradle-wrapper - uses: actions/cache@v3 - with: - key: ${{ runner.os }}-gradle-wrapper-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }} - path: | - ~/.gradle/wrapper - - uses: gradle/wrapper-validation-action@v1 - name: Validate Gradle Wrapper - - - name: Set up JDK 17 - uses: actions/setup-java@v3 - with: - java-version: 17 - distribution: zulu - - - name: Build with Gradle - env: - ORG_GRADLE_PROJECT_sonatypeUsername: rahulsom - ORG_GRADLE_PROJECT_sonatypePassword: ${{secrets.ORG_GRADLE_PROJECT_sonatypePassword}} - ORG_GRADLE_PROJECT_signingKey: ${{secrets.ORG_GRADLE_PROJECT_signingKey}} - ORG_GRADLE_PROJECT_signingPassword: ${{secrets.ORG_GRADLE_PROJECT_signingPassword}} - run: | - ./gradlew -Prelease.useLastTag=true build final --stacktrace --no-parallel diff --git a/.github/workflows/build-tag-rc.yml b/.github/workflows/build-tag-rc.yml deleted file mode 100644 index 1a34f30..0000000 --- a/.github/workflows/build-tag-rc.yml +++ /dev/null @@ -1,45 +0,0 @@ -name: Build Candidate Release - -on: - push: - tags: - - v[0-9]+.[0-9]+.[0-9]+-rc.[0-9]+ - -jobs: - build: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v3 - - - name: Cache Gradle Caches - id: cache-gradle-caches - uses: actions/cache@v3 - with: - key: ${{ runner.os }}-${{hashFiles('**/*.gradle')}} - path: | - ~/.gradle/caches - - name: Cache Gradle Wrapper - id: cache-gradle-wrapper - uses: actions/cache@v3 - with: - key: ${{ runner.os }}-gradle-wrapper-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }} - path: | - ~/.gradle/wrapper - - uses: gradle/wrapper-validation-action@v1 - name: Validate Gradle Wrapper - - - name: Set up JDK 17 - uses: actions/setup-java@v3 - with: - java-version: 17 - distribution: zulu - - - name: Build with Gradle - env: - ORG_GRADLE_PROJECT_sonatypeUsername: rahulsom - ORG_GRADLE_PROJECT_sonatypePassword: ${{secrets.ORG_GRADLE_PROJECT_sonatypePassword}} - ORG_GRADLE_PROJECT_signingKey: ${{secrets.ORG_GRADLE_PROJECT_signingKey}} - ORG_GRADLE_PROJECT_signingPassword: ${{secrets.ORG_GRADLE_PROJECT_signingPassword}} - run: | - ./gradlew -Prelease.useLastTag=true build candidate --stacktrace --no-parallel diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..912f63e --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,18 @@ +name: Gradle Build + +on: + pull_request: + branches: ['*'] + push: + branches: ['*'] + tags: + - 'v[0-9]+.[0-9]+.[0-9]+' + +jobs: + build: + uses: rahulsom/_/.github/workflows/gradle.yml@main + secrets: + DOCKER_PASSWORD: ${{ secrets.DOCKERHUB_TOKEN }} + ORG_GRADLE_PROJECT_sonatypePassword: ${{ secrets.ORG_GRADLE_PROJECT_sonatypePassword }} + ORG_GRADLE_PROJECT_signingKey: ${{ secrets.ORG_GRADLE_PROJECT_signingKey }} + ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.ORG_GRADLE_PROJECT_signingPassword }}