Merge pull request #440 from ThoughtWorks-SEA/dependabot/gradle/com.d… #1387
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build | |
on: | |
push: | |
branches: [master] | |
paths-ignore: ["**.md"] | |
pull_request: | |
branches: [master] | |
paths-ignore: ["**.md"] | |
create: | |
tags: | |
- '*' | |
permissions: | |
contents: read | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- uses: actions/setup-java@v3 | |
with: | |
distribution: temurin | |
java-version: 17 | |
- name: Gradle Build, Lint, Test | |
uses: gradle/gradle-build-action@v2 | |
with: | |
arguments: build | |
gradle-home-cache-cleanup: true | |
- name: Save test results artifact | |
if: always() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: test-report | |
path: build/reports/tests/test | |
- name: Upload coverage to codecov.io | |
uses: codecov/[email protected] | |
- name: Gradle Local Docker Trial Build | |
uses: gradle/gradle-build-action@v2 | |
if: ${{ !endsWith(github.ref, '/master') && !startsWith(github.ref, 'refs/tags/') }} | |
env: | |
JAVA_HOME: ${{ env.JAVA_HOME }} | |
with: | |
arguments: 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: Login to Docker Hub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: docker.io | |
username: ${{ vars.DOCKER_HUB_ID }} | |
password: ${{ secrets.DOCKER_HUB_TOKEN }} | |
- if: ${{ endsWith(github.ref, '/master') || startsWith(github.ref, 'refs/tags/') }} | |
name: Gradle Official Docker Build & Push | |
uses: gradle/gradle-build-action@v2 | |
env: | |
JAVA_HOME: ${{ env.JAVA_HOME }} | |
with: | |
arguments: jibGitHubContainerRegistry jibDockerHub -x check |