Add docker release workflow (#2500)

Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
This commit is contained in:
Avgustin Marinov
2025-06-26 10:39:32 +03:00
committed by GitHub
parent 2f3e2ffcd0
commit 90942642ea
7 changed files with 69 additions and 1 deletions

View File

@@ -6,7 +6,10 @@ on:
jobs:
greeting:
# only on original eclipse-hawkbit/hawkbit repo
if: github.repository == 'eclipse-hawkbit/hawkbit'
runs-on: ubuntu-latest
steps:
- uses: actions/first-interaction@v1
with:

View File

@@ -9,6 +9,8 @@ on:
jobs:
license-scan:
# only on original eclipse-hawkbit/hawkbit repo or when manually triggered
if: github.repository == 'eclipse-hawkbit/hawkbit' || github.event_name == 'workflow_dispatch'
runs-on: ubuntu-latest
permissions:

View File

@@ -10,6 +10,8 @@ on:
jobs:
release:
# only on original eclipse-hawkbit/hawkbit repo
if: github.repository == 'eclipse-hawkbit/hawkbit'
runs-on: ubuntu-latest
permissions:

58
.github/workflows/release_docker.yml vendored Normal file
View File

@@ -0,0 +1,58 @@
# This workflow builds and releases Docker images for Hawkbit applications.
# It should be run from personal forks of the hawkbit repository with set .
# personal DOCKERHUB_USERNAME var and DOCKERHUB_TOKEN secret.
name: Release Docker Image
on:
# enable running the workflow manually
workflow_dispatch:
inputs:
revision:
description: 'Release version'
default: '0-SNAPSHOT'
jobs:
build:
# only on fork of eclipse-hawkbit/hawkbit repo - see the note above
if: github.repository != 'eclipse-hawkbit/hawkbit'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: "Release ${{ github.event.inputs.revision }}"
run: echo "Releasing ${{ github.event.inputs.revision }}"
- name: Log into Docker Hub
uses: docker/login-action@v3
with:
username: ${{ vars.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Setup
run: |
ALL_APPS=(
# microservices
"hawkbit-ddi-server", "hawkbit-dmf-server", "hawkbit-mgmt-server", "hawkbit-simple-ui",
# monolith
"hawkbit-update-server"
# db init
build "hawkbit-repository-jpa-init")
echo "ALL_APPS=${ALL_APPS[*]}" >> $GITHUB_ENV
echo "REVISION=${{ github.event.inputs.revision }}" >> $GITHUB_ENV
- name: Build Docker Images
run: |
cd docker/build
for app in "${ALL_APPS[@]}"; do
docker buildx build -t hawkbit/${APP}:${REVISION} --build-arg HAWKBIT_APP=${APP} --build-arg HAWKBIT_VERSION=${REVISION} .
done
- name: Push Docker Images
run: |
cd docker/build
for app in "${ALL_APPS[@]}"; do
docker push hawkbit/${APP}:${REVISION}
docker tag hawkbit/${APP}:${REVISION} hawkbit/${APP}:latest
docker push hawkbit/${APP}:latest
done

View File

@@ -9,6 +9,7 @@ on:
jobs:
stale:
runs-on: ubuntu-latest
steps:
- uses: actions/stale@v9
with:

View File

@@ -9,6 +9,8 @@ on:
jobs:
trivy-scan:
# only on original eclipse-hawkbit/hawkbit repo or when manually triggered
if: github.repository == 'eclipse-hawkbit/hawkbit' || github.event_name == 'workflow_dispatch'
runs-on: ubuntu-latest
permissions:

View File

@@ -46,7 +46,7 @@ function build() {
fi
echo "docker file : ${DOCKER_FILE}"
docker build -t hawkbit/$1:${TAG} --build-arg HAWKBIT_APP=$1 --build-arg HAWKBIT_VERSION=${VERSION} -f ${DOCKER_FILE} "${MVN_REPO}"
docker buildx build -t hawkbit/$1:${TAG} --build-arg HAWKBIT_APP=$1 --build-arg HAWKBIT_VERSION=${VERSION} -f ${DOCKER_FILE} "${MVN_REPO}"
}
if [ -z "$1" ]; then