From ca042ab10edf06a9f980bbb23fa94aea9519a938 Mon Sep 17 00:00:00 2001 From: Leonhardt Koepsell Date: Sat, 2 Nov 2024 14:27:52 -0500 Subject: [PATCH] Refactor workflows Authored-by: Leonhardt Koepsell --- .github/actions/check.yml | 24 ++++++++++++++++++++++++ .github/workflows/check.yml | 21 +-------------------- .github/workflows/pr.yml | 10 ++++++++++ .github/workflows/publish.yml | 10 +++++++--- 4 files changed, 42 insertions(+), 23 deletions(-) create mode 100644 .github/actions/check.yml create mode 100644 .github/workflows/pr.yml diff --git a/.github/actions/check.yml b/.github/actions/check.yml new file mode 100644 index 0000000..7361249 --- /dev/null +++ b/.github/actions/check.yml @@ -0,0 +1,24 @@ +name: CI Check + +jobs: + check: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup JDK + uses: actions/setup-java@v4 + with: + distribution: temurin + java-version: 21 + cache: gradle + + - name: Setup Docker + uses: docker/setup-buildx-action@v3 + + - name: Run Bootstrap + run: ./bootstrap.sh + + - name: Run Gradle Check + run: ./gradlew check diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 355f358..741e9bd 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -7,23 +7,4 @@ on: jobs: check: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Setup JDK - uses: actions/setup-java@v4 - with: - distribution: temurin - java-version: 21 - cache: gradle - - - name: Setup Docker - uses: docker/setup-buildx-action@v3 - - - name: Run Bootstrap - run: ./bootstrap.sh - - - name: Run Gradle Check - run: ./gradlew check + uses: ./.github/actions/check.yml diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml new file mode 100644 index 0000000..cc4a758 --- /dev/null +++ b/.github/workflows/pr.yml @@ -0,0 +1,10 @@ +name: Pull Request + +on: + pull_request: + branches: + - main + +jobs: + pr-check: + uses: ./.github/actions/check.yml diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index d72db06..d793c5c 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -6,8 +6,12 @@ on: - 'v*' jobs: + check: + uses: ./.github/actions/check.yml + publish: if: github.repository == 'codebandits/gradle-container-plugin' + needs: check runs-on: ubuntu-latest permissions: contents: write @@ -23,9 +27,6 @@ jobs: java-version: 21 cache: gradle - - name: Install SOPS - uses: mdgreenwald/mozilla-sops-action@v1 - - name: Load Infrastructure Configuration uses: codebandits/github-actions/load-env@main id: configuration @@ -38,6 +39,9 @@ jobs: workload_identity_provider: ${{ steps.configuration.outputs.GCP_WORKLOAD_IDENTITY_PROVIDER }} service_account: ${{ steps.configuration.outputs.GCP_SERVICE_ACCOUNT }} + - name: Install SOPS + uses: mdgreenwald/mozilla-sops-action@v1 + - name: Set Version run: | TAG="${{ github.ref_name }}"