Skip to content

Build

Build #1332

Workflow file for this run

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@v3
with:
fetch-depth: 0
- name: ASDF setup
uses: asdf-vm/actions/setup@v2
- name: ASDF Cache
id: asdf-cache
uses: actions/cache@v3
with:
path: ${{ env.ASDF_DIR }}
key: ${{ runner.os }}-${{ hashFiles('**/.tool-versions') }}
- name: ASDF tool install
uses: asdf-vm/actions/install@v2
if: steps.asdf-cache.outputs.cache-hit != 'true'
- name: Set JAVA_HOME from ASDF
run: echo "JAVA_HOME=$(dirname $(dirname $(asdf which java)))" >> $GITHUB_ENV
- name: Gradle Build, Lint, Test
uses: gradle/gradle-build-action@v2
env:
JAVA_HOME: ${{ env.JAVA_HOME }}
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@v2
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@v2
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