Skip to content

Commit

Permalink
github/workflows: add the ability to push tags
Browse files Browse the repository at this point in the history
Signed-off-by: Rouven Czerwinski <r.czerwinski@pengutronix.de>
  • Loading branch information
Emantor committed May 4, 2023
1 parent 573550e commit d84ca80
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ name: docker build
on:
push:
branches: [ master ]
tags:
- '*'

jobs:
docker:
Expand All @@ -24,10 +26,21 @@ jobs:
docker-compose -f dockerfiles/staging/docker-compose.yml up --exit-code-from client client
docker-compose -f dockerfiles/staging/docker-compose.yml down
docker images
- name: Tag latest images
run: |
docker tag labgrid-client ${{ secrets.DOCKERHUB_PREFIX }}client
docker tag labgrid-exporter ${{ secrets.DOCKERHUB_PREFIX }}exporter
docker tag labgrid-coordinator ${{ secrets.DOCKERHUB_PREFIX }}coordinator
docker push ${{ secrets.DOCKERHUB_PREFIX }}client
docker push ${{ secrets.DOCKERHUB_PREFIX }}exporter
docker push ${{ secrets.DOCKERHUB_PREFIX }}coordinator
docker images
- name: Tag release image
if: startsWith(github.ref, 'refs/tags')
run: |
docker tag labgrid-client ${{ secrets.DOCKERHUB_PREFIX }}client:${GITHUB_REF_NAME}
docker tag labgrid-exporter ${{ secrets.DOCKERHUB_PREFIX }}exporter:${GITHUB_REF_NAME}
docker tag labgrid-coordinator ${{ secrets.DOCKERHUB_PREFIX }}coordinator:${GITHUB_REF_NAME}
- name: Push to dockerhub
run: |
docker push --all-tags ${{ secrets.DOCKERHUB_PREFIX }}client
docker push --all-tags ${{ secrets.DOCKERHUB_PREFIX }}exporter
docker push --all-tags ${{ secrets.DOCKERHUB_PREFIX }}coordinator
- name: Show images again
run: docker images

0 comments on commit d84ca80

Please sign in to comment.