-
Notifications
You must be signed in to change notification settings - Fork 1
51 lines (43 loc) · 1.59 KB
/
workflow.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
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