Skip to content

Commit

Permalink
Use Gradle Github actions as currently recommended
Browse files Browse the repository at this point in the history
  • Loading branch information
chadlwilson committed Jan 30, 2024
1 parent f0c2dea commit 0d47336
Showing 1 changed file with 17 additions and 23 deletions.
40 changes: 17 additions & 23 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,15 @@ jobs:
contents: read
packages: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Login to GitHub Container Registry
if: ${{ endsWith(github.ref, '/master') || startsWith(github.ref, 'refs/tags/') }}
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- uses: actions/checkout@v4
with:
fetch-depth: 0

Expand All @@ -31,12 +38,13 @@ jobs:
distribution: temurin
java-version: 17

- name: Gradle Build, Lint, Test
uses: gradle/actions/setup-gradle@v3
- uses: gradle/actions/setup-gradle@v3
with:
arguments: build
gradle-home-cache-cleanup: true

- name: Gradle Build
run: ./gradlew build

- name: Save test results artifact
if: always()
uses: actions/upload-artifact@v4
Expand All @@ -48,23 +56,9 @@ jobs:
uses: codecov/[email protected]

- name: Gradle Local Docker Trial Build
uses: gradle/actions/setup-gradle@v3
if: ${{ !endsWith(github.ref, '/master') && !startsWith(github.ref, 'refs/tags/') }}
env:
JAVA_HOME: ${{ env.JAVA_HOME }}
with:
arguments: jibDockerBuild -x check
run: ./gradlew jibDockerBuild -x check

- if: ${{ endsWith(github.ref, '/master') || startsWith(github.ref, 'refs/tags/') }}
name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- if: ${{ endsWith(github.ref, '/master') || startsWith(github.ref, 'refs/tags/') }}
name: Gradle Official Docker Build & Push
uses: gradle/actions/setup-gradle@v3
with:
arguments: jibGitHubContainerRegistry -x check
- name: Gradle Official Docker Build & Push
if: ${{ endsWith(github.ref, '/master') || startsWith(github.ref, 'refs/tags/') }}
run: ./gradlew jibGitHubContainerRegistry -x check

0 comments on commit 0d47336

Please sign in to comment.