Skip to content

💚 (backend) Change name to hopps, add artifact id to cont… #5

💚 (backend) Change name to hopps, add artifact id to cont…

💚 (backend) Change name to hopps, add artifact id to cont… #5

Workflow file for this run

name: Build and test backend
on:
push:
paths:
- backend/**
- .github/workflows/backend.yml
branches: ['**']
tags: [ 'verein-*.*.*' ]
env:
BASE_IMAGE_NAME: ghcr.io/hopps-app/hopps/vereine # org_name/repo_name/artifact_id
# prefix which needs to be in front of version tags
VERSION_TAG_PREFIX: 'verein-'
jobs:
build-code-and-container:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
cache: maven
- name: mvn package
run: mvn -B package --file backend/pom.xml
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.BASE_IMAGE_NAME }}
tags: |
# increasing run number tag on main
type=raw,value=${{ github.run_number }},enable={{is_default_branch}}
# for version tags (only works for tags)
type=match,pattern=${{ env.VERSION_TAG_PREFIX }}\d.\d.\d
# for containers on feature branches
type=ref,event=branch,enable=${{ github.ref_name != github.event.repository.default_branch }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to DockerHub
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v6
with:
context: backend/de.op-paf.vereinsfin.vereine
file: backend/de.op-paf.vereinsfin.vereine/src/main/docker/Dockerfile.jvm
push: true
tags: ${{ steps.meta.outputs.tags }} # tags from the docker/metadata-action