Skip to content

Build and publish backend to prod #5

Build and publish backend to prod

Build and publish backend to prod #5

name: Build and publish backend to prod
on:
workflow_dispatch:
inputs:
version:
description: 'Which backend version should be deployed to production?'
required: true
default: '0.0.1'
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Git checkout to specific version
uses: actions/checkout@v4
with:
ref: refs/tags/backend-${{ github.event.inputs.version }}
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: "17"
distribution: "temurin"
cache: "maven"
- name: Build with Maven
run: mvn -B verify -f mobidam-sst-management-backend/pom.xml -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=WARN
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract Docker metadata
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ github.repository }}-backend
- name: Build and push image
uses: docker/build-push-action@v4
with:
context: ./mobidam-sst-management-backend
push: true
tags: ghcr.io/it-at-m/mobidam-sst-management-backend:prod