forked from eclipse-hawkbit/hawkbit
-
Notifications
You must be signed in to change notification settings - Fork 0
78 lines (67 loc) · 2.64 KB
/
Copy pathrelease_docker.yaml
File metadata and controls
78 lines (67 loc) · 2.64 KB
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
69
70
71
72
73
74
75
76
77
78
# This workflow builds and releases Docker images for Hawkbit applications to DockerHub.
# It should be run from personal forks of the hawkbit repository with set .
# personal DOCKERHUB_USERNAME var and DOCKERHUB_TOKEN secret.
name: Release - Docker Images
on:
# enable running the workflow manually
workflow_dispatch:
inputs:
revision:
description: 'Release version'
default: '0-SNAPSHOT'
permissions:
contents: read
jobs:
release_docker:
# 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/[email protected]
- name: "Release ${{ inputs.revision }}"
run: echo "Releasing ${{ inputs.revision }}"
- name: Setup
run: |
ALL_APPS=(
# microservices
"hawkbit-ddi-server", "hawkbit-dmf-server", "hawkbit-mgmt-server", "hawkbit-ui",
# monolith
"hawkbit-update-server",
# db init
"hawkbit-repository-jpa-init")
echo "ALL_APPS_STRING=${ALL_APPS[*]}" >> $GITHUB_ENV
echo "REVISION=${{ github.event.inputs.revision }}" >> $GITHUB_ENV
- name: Build Docker Images
run: |
ALL_APPS=() # Initialize an empty
for APP in $(echo "${ALL_APPS_STRING}" | tr ',' '\n' | xargs); do
ALL_APPS+=("${APP}") # Add trimmed app
done
cd docker/build
for APP in "${ALL_APPS[@]}"; do
if [ "${APP}" == "hawkbit-repository-jpa-init" ]; then
DOCKER_FILE="Dockerfile_dbinit"
else
DOCKER_FILE="Dockerfile"
fi
echo "Build ${APP}, docker file : ${DOCKER_FILE}"
docker buildx build -t hawkbit/${APP}:${REVISION} --build-arg HAWKBIT_APP=${APP} --build-arg HAWKBIT_VERSION=${REVISION} -f ${DOCKER_FILE} .
done
- name: Log into Docker Hub
uses: docker/[email protected]
with:
username: ${{ vars.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Push Docker Images
run: |
ALL_APPS=()
for APP in $(echo "${ALL_APPS_STRING}" | tr ',' '\n' | xargs); do
ALL_APPS+=("${APP}") # trims chunk to fully qualified app name
done
for APP in "${ALL_APPS[@]}"; do
echo "Deploying ${APP}..."
docker push hawkbit/${APP}:${REVISION}
docker tag hawkbit/${APP}:${REVISION} hawkbit/${APP}:latest
docker push hawkbit/${APP}:latest
echo "${APP} deployed."
done