-
Notifications
You must be signed in to change notification settings - Fork 1
43 lines (39 loc) · 1.25 KB
/
build.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
name: Build and push Docker image
on:
push:
branches:
- develop
tags:
- v[0-9]+.[0-9]+.[0-9]+
env:
IMAGE_NAME: ghcr.io/${{ github.repository_owner }}/tara-govsso-exampleclient
jobs:
build:
name: Build
permissions:
packages: write
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up JDK
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: temurin
cache: maven
- name: Build
# TODO (AUT-1470): Run tests
run: mvn --batch-mode --update-snapshots -Dspring-boot.build-image.imageName=$IMAGE_NAME -DskipTests dependency:tree spring-boot:build-image
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Tag and push Docker image
# Docker tag will have the same name as Git branch/tag, but without the preceding "v" in case of a tag
run: |
docker_tag=$(echo "$GITHUB_REF" | sed 's|.*/v\?||')
docker tag $IMAGE_NAME $IMAGE_NAME:$docker_tag
docker push $IMAGE_NAME:$docker_tag