Skip to content

Cover release branches for build and push workflow #42

Cover release branches for build and push workflow

Cover release branches for build and push workflow #42

name: "Build and push"
on:
push:
branches:
- main
- develop
- release/*
pull_request:
branches:
- main
- develop
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Docker - Login
uses: docker/login-action@v3
if: ${{ github.actor != 'dependabot[bot]' }}
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Setup - Java
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '21'
cache: 'maven'
- name: Build
run: mvn --batch-mode --update-snapshots clean verify spring-boot:build-image
- name: Spotless
run: mvn spotless:check
- name: Docker - Push
if: ${{ github.ref == 'refs/heads/main' }}
run: |
VERSION=$(mvn help:evaluate -Dexpression="project.version" -q -DforceStdout)
docker push ehrbase/migration-tool:${VERSION}