Skip to content

Build and publish latest image #1

Build and publish latest image

Build and publish latest image #1

name: Build and publish latest image
on:
workflow_dispatch:
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
build:
name: "Build and publish with build number"
runs-on: [self-hosted, linux, X64]
steps:
- name: checkout
uses: actions/checkout@v2
- name: get helm
uses: azure/setup-helm@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: 17
- 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
- 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: Upload Maven build artifact
uses: actions/upload-artifact@v1
with:
name: artifact
path: application/target/application-${{ env.VERSION }}.jar
- name: Log in to the Container registry
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
with:
registry: ${{ vars.INTERNAL_REGISTRY_URL }}
username: docker
password: ${{ secrets.INTERNAL_REGISTRY_PASSWORD }}
- name: Build and push Docker image
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
with:
context: .
push: true
tags: ${{ vars.INTERNAL_REGISTRY_URL }}/smartparkingconfig:${{ env.VERSION_BUILD }}
labels: "latest"