Skip to content

build/pom: updating sqldump version & maven (dependency, war) plugins #15

build/pom: updating sqldump version & maven (dependency, war) plugins

build/pom: updating sqldump version & maven (dependency, war) plugins #15

Workflow file for this run

# https://docs.github.com/en/actions/publishing-packages/publishing-docker-images#publishing-images-to-github-packages
name: Docker-deploy
on:
push:
branches: ['deploy'] # release?
workflow_dispatch:
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
PROJECT_NAME: qon-demo-springboot
PROJECT_DIR: demo/qon-demo-springboot
jobs:
build-and-push-image:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Log in to the Container registry
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) from Git repo for Docker
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
- name: Set up Java
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'temurin'
cache: maven
- name: Build all with Maven
run: mvn -V -B package --file pom.xml
- name: Build project jar
run: mkdir -p ${{ env.PROJECT_DIR }}/target/dependency && cd ${{ env.PROJECT_DIR }}/target/dependency && jar -xf ../qon-demo-springboot.jar
# https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions
- name: Set project version
id: set_version
run: echo PROJECT_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout) >> $GITHUB_ENV
- name: Build and push Docker image
uses: docker/build-push-action@v4
with:
context: ./${{ env.PROJECT_DIR }}
file: ./${{ env.PROJECT_DIR }}/src/main/docker/Dockerfile
push: true
tags: ${{ env.REGISTRY }}/${{ github.actor }}/${{ env.PROJECT_NAME }}:${{ env.PROJECT_VERSION }},${{ env.REGISTRY }}/${{ github.actor }}/${{ env.PROJECT_NAME }}:latest
labels: ${{ steps.meta.outputs.labels }}