Skip to content

Build Info controller, app tests, #9

Build Info controller, app tests,

Build Info controller, app tests, #9

Workflow file for this run

name: Build
on:
push:
branches: [ main ]
tags:
- v*
pull_request:
types: [ opened, reopened ]
branches: [ main ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v2
- name: Set up JDK 21
uses: actions/setup-java@v2
with:
java-version: '21'
distribution: 'temurin'
- name: Cache Maven packages
uses: actions/cache@v2
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2
- name: Generate keystore
run: ./generate-keystore.sh
- name: Generate build info
run: ./generate-build-info.sh
- name: Build with Maven
run: mvn --batch-mode --update-snapshots verify
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v3
with:
images: ${{ github.repository_owner }}/${{ github.event.repository.name }}
- name: Log in to Docker Hub
if: ${{ github.event.repository.name == 'spring-boot-java-example' && github.event_name != 'pull_request' }}
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and push Docker image
uses: docker/build-push-action@v2
with:
context: .
push: ${{ github.event.repository.name == 'spring-boot-java-example' && github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}