-
Notifications
You must be signed in to change notification settings - Fork 0
68 lines (59 loc) · 1.77 KB
/
build-publish-latest.yaml
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
name: Build and publish latest image
on:
workflow_dispatch:
env:
REGISTRY: ghcr.io
IMAGE_NAME: smartparkingconfig
DOCKERHUB_USERNAME: starwit
DOCKERHUB_ORG: starwitorg
jobs:
build:
name: "Build and publish with build number"
runs-on: [self-hosted, linux, X64]
steps:
- name: checkout
uses: actions/checkout@v2
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 21
- name: Set up Maven
uses: stCarolas/[email protected]
with:
maven-version: 3.9.2
- name: setup node
uses: actions/setup-node@v3
with:
node-version: 18
- run: npm --version
- run: node --version
- run: mvn --version
- name: get version from pom.xml
run: |
echo "VERSION_BUILD=$( mvn help:evaluate -Dexpression=project.version -q -DforceStdout )-${{ github.run_number }}" >> $GITHUB_ENV
echo "VERSION_JAR=$( mvn help:evaluate -Dexpression=project.version -q -DforceStdout )" >> $GITHUB_ENV
- name: npm install
run: |
if [ -d "webclient/app" ]; then
cd webclient/app
npm install
fi
- name: Build with Maven
run: mvn clean -B package -P frontend --file pom.xml
env:
CI: false
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ env.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
file: ./dockerfile
push: true
tags: ${{ env.DOCKERHUB_ORG }}/${{ env.IMAGE_NAME }}:${{ env.VERSION_BUILD }}