-
Notifications
You must be signed in to change notification settings - Fork 215
77 lines (75 loc) · 4.88 KB
/
push-dockerhub.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
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
# Copyright (c) 2020 Contributors to the Eclipse Foundation
#
# See the NOTICE file(s) distributed with this work for additional
# information regarding copyright ownership.
#
# This program and the accompanying materials are made available under the
# terms of the Eclipse Public License 2.0 which is available at
# http://www.eclipse.org/legal/epl-2.0
#
# SPDX-License-Identifier: EPL-2.0
name: push-dockerhub
on:
push:
tags:
- '**'
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: azure/docker-login@v1
with:
username: eclipsedittobot
password: ${{ secrets.DOCKER_HUB_TOKEN }}
- name: Branch name
id: branch_name
run: |
echo "IMAGE_TAG=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
echo "IMAGE_MINOR_TAG=$(echo ${GITHUB_REF#refs/tags/} | cut -d. -f-2)" >> $GITHUB_ENV
echo "IMAGE_MAJOR_TAG=$(echo ${GITHUB_REF#refs/tags/} | cut -d. -f-1)" >> $GITHUB_ENV
echo "MILESTONE_OR_RC_SUFFIX=$(echo ${GITHUB_REF#refs/tags/} | cut -d- -f2)" >> $GITHUB_ENV
- name: Building Docker images for tag
run: |
echo $IMAGE_TAG
echo "Full version: $IMAGE_TAG"
echo "Minor version: $IMAGE_MINOR_TAG"
echo "Major version: $IMAGE_MAJOR_TAG"
echo "Milestone or RC suffix: $MILESTONE_OR_RC_SUFFIX"
- name: Build the Docker images
run: |
docker build -f services/dockerfile-release --build-arg SERVICE_STARTER=ditto-services-policies-starter --build-arg SERVICE_VERSION=$IMAGE_TAG -t eclipse/ditto-policies:$IMAGE_TAG -t eclipse/ditto-policies:$IMAGE_MINOR_TAG -t eclipse/ditto-policies:$IMAGE_MAJOR_TAG -t eclipse/ditto-policies:latest .;
docker build -f services/dockerfile-release --build-arg SERVICE_STARTER=ditto-services-things-starter --build-arg SERVICE_VERSION=$IMAGE_TAG -t eclipse/ditto-things:$IMAGE_TAG -t eclipse/ditto-things:$IMAGE_MINOR_TAG -t eclipse/ditto-things:$IMAGE_MAJOR_TAG -t eclipse/ditto-things:latest .;
docker build -f services/dockerfile-release --build-arg SERVICE_STARTER=ditto-services-thingsearch-starter --build-arg SERVICE_VERSION=$IMAGE_TAG -t eclipse/ditto-things-search:$IMAGE_TAG -t eclipse/ditto-things-search:$IMAGE_MINOR_TAG -t eclipse/ditto-things-search:$IMAGE_MAJOR_TAG -t eclipse/ditto-things-search:latest .;
docker build -f services/dockerfile-release --build-arg SERVICE_STARTER=ditto-services-concierge-starter --build-arg SERVICE_VERSION=$IMAGE_TAG -t eclipse/ditto-concierge:$IMAGE_TAG -t eclipse/ditto-concierge:$IMAGE_MINOR_TAG -t eclipse/ditto-concierge:$IMAGE_MAJOR_TAG -t eclipse/ditto-concierge:latest .;
docker build -f services/dockerfile-release --build-arg SERVICE_STARTER=ditto-services-gateway-starter --build-arg SERVICE_VERSION=$IMAGE_TAG -t eclipse/ditto-gateway:$IMAGE_TAG -t eclipse/ditto-gateway:$IMAGE_MINOR_TAG -t eclipse/ditto-gateway:$IMAGE_MAJOR_TAG -t eclipse/ditto-gateway:latest .;
docker build -f services/dockerfile-release --build-arg SERVICE_STARTER=ditto-services-connectivity-starter --build-arg SERVICE_VERSION=$IMAGE_TAG -t eclipse/ditto-connectivity:$IMAGE_TAG -t eclipse/ditto-connectivity:$IMAGE_MINOR_TAG -t eclipse/ditto-connectivity:$IMAGE_MAJOR_TAG -t eclipse/ditto-connectivity:latest .;
- name: Push the Docker images to Docker Hub
run: |
docker push eclipse/ditto-policies:$IMAGE_TAG;
docker push eclipse/ditto-things:$IMAGE_TAG;
docker push eclipse/ditto-things-search:$IMAGE_TAG;
docker push eclipse/ditto-concierge:$IMAGE_TAG;
docker push eclipse/ditto-gateway:$IMAGE_TAG;
docker push eclipse/ditto-connectivity:$IMAGE_TAG;
- name: Push the Docker images of tag aliases to Docker Hub
if: env.MILESTONE_OR_RC_SUFFIX == env.IMAGE_TAG
run: |
docker push eclipse/ditto-policies:$IMAGE_MINOR_TAG;
docker push eclipse/ditto-policies:$IMAGE_MAJOR_TAG;
docker push eclipse/ditto-policies:latest;
docker push eclipse/ditto-things:$IMAGE_MINOR_TAG;
docker push eclipse/ditto-things:$IMAGE_MAJOR_TAG;
docker push eclipse/ditto-things:latest;
docker push eclipse/ditto-things-search:$IMAGE_MINOR_TAG;
docker push eclipse/ditto-things-search:$IMAGE_MAJOR_TAG;
docker push eclipse/ditto-things-search:latest;
docker push eclipse/ditto-concierge:$IMAGE_MINOR_TAG;
docker push eclipse/ditto-concierge:$IMAGE_MAJOR_TAG;
docker push eclipse/ditto-concierge:latest;
docker push eclipse/ditto-gateway:$IMAGE_MINOR_TAG;
docker push eclipse/ditto-gateway:$IMAGE_MAJOR_TAG;
docker push eclipse/ditto-gateway:latest;
docker push eclipse/ditto-connectivity:$IMAGE_MINOR_TAG;
docker push eclipse/ditto-connectivity:$IMAGE_MAJOR_TAG;
docker push eclipse/ditto-connectivity:latest;