Skip to content

Merge pull request #79 from geir-eilertsen/geir-eilertsen-patch-1 #156

Merge pull request #79 from geir-eilertsen/geir-eilertsen-patch-1

Merge pull request #79 from geir-eilertsen/geir-eilertsen-patch-1 #156

Workflow file for this run

name: CI
on:
push:
branches:
- master # Run only on pushes to the main branch
pull_request:
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v3
- name: Set up JDK 23
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '23'
cache: maven # Enable dependency caching for faster builds
- name: Extract Maven project version
id: version
run: |
VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
echo "VERSION=$VERSION" >> $GITHUB_ENV
- name: build the app
run: |
mvn clean
mvn -B package --no-transfer-progress --file pom.xml --activate-profiles with-docker
- name: Inspect Docker Images
run: |
docker images | grep -v "IMAGE ID" | sort
docker inspect --format='{{json .Config.Labels}}' marvin:latest | jq
- name: Login to docker hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
- name: Push Docker Image
run: |
docker tag marvin:${{ env.VERSION }} ${{ secrets.DOCKER_HUB_USERNAME }}/marvin:${{ env.VERSION }}
docker tag marvin:latest ${{ secrets.DOCKER_HUB_USERNAME }}/marvin:latest
docker push ${{ secrets.DOCKER_HUB_USERNAME }}/marvin:${{ env.VERSION }}
docker push ${{ secrets.DOCKER_HUB_USERNAME }}/marvin:latest