77 release :
88 types : [published]
99
10+ env :
11+ IMAGE_TAG : latest
12+
1013jobs :
1114
1215 tests :
@@ -109,6 +112,10 @@ jobs:
109112 name : assembles_${{ github.sha }}
110113 path : build/libs
111114
115+ - name : Define image tag
116+ run :
117+ if [[ ${{ github.ref }} == refs/heads/master -o ${{ github.ref }} == refs/heads/2.x.x-REACTIVE ]]; then export IMAGE_TAG=latest; else export IMAGE_TAG=${{ github.ref }}#refs/heads/; fi;
118+
112119 - name : Set up QEMU
113120 uses : docker/setup-qemu-action@v1
114121
@@ -127,7 +134,7 @@ jobs:
127134 with :
128135 context : .
129136 push : true
130- tags : openplatform/open-state:${{ github.event.release.tag_name }}
137+ tags : openplatform/open-state:${{ env.IMAGE_TAG }}
131138 file : docker/Dockerfile
132139
133140
@@ -155,10 +162,10 @@ jobs:
155162 run : |
156163 export DOCKER_HOST="ssh://gitlab@${{ secrets.SPRINT_SERVER }}"
157164 export MONGODB_PASSWORD="${{ secrets.SPRINT_MONGO_PASSWORD }}"
158- export DOCKER_IMAGE_TAG="openplatform/open-state:${{ github.event.release.tag_name }}"
165+ export DOCKER_IMAGE_TAG="openplatform/open-state:${{ env.IMAGE_TAG }}"
159166 docker login -u ${{ secrets.DOCKERHUB_USER_NAME }} -p ${{ secrets.DOCKERHUB_PASSWORD }}
160167 docker-compose -f docker-compose-server.yml up -d
161- docker image ls --filter reference=openplatform/open-state:${{ github.event.release.tag_name }} -q | tail -n +4 | xargs --no-run-if-empty docker image rm
168+ docker image ls --filter reference=openplatform/open-state:${{ env.IMAGE_TAG }} -q | tail -n +4 | xargs --no-run-if-empty docker image rm
162169
163170
164171 deploy-production :
@@ -184,7 +191,7 @@ jobs:
184191 run : |
185192 export DOCKER_HOST="ssh://gitlab@${{ secrets.PROD_SERVER }}"
186193 export MONGODB_PASSWORD="${{ secrets.PROD_MONGO_PASSWORD }}"
187- export DOCKER_IMAGE_TAG="openplatform/open-state:${{ github.event.release.tag_name }}"
194+ export DOCKER_IMAGE_TAG="openplatform/open-state:${{ env.IMAGE_TAG }}"
188195 docker login -u ${{ secrets.DOCKERHUB_USER_NAME }} -p ${{ secrets.DOCKERHUB_PASSWORD }}
189196 docker-compose -f docker-compose-server.yml up -d
190- docker image ls --filter reference=openplatform/open-state:${{ github.event.release.tag_name }} -q | tail -n +4 | xargs --no-run-if-empty docker image rm
197+ docker image ls --filter reference=openplatform/open-state:${{ env.IMAGE_TAG }} -q | tail -n +4 | xargs --no-run-if-empty docker image rm
0 commit comments