upgrade docker build-push-action to v2 and use tags, labels from metadata-action
This should fix missing patch 0 releases und updating major.minor images with patch releases
@@ -28,28 +28,38 @@ jobs:
- name: Test
run: go test -v -timeout 300s -race ./...
- - name: Build and push edge docker image
+ - name: Login to DockerHub
+ if: github.event_name != 'pull_request'
+ uses: docker/login-action@v1
+ with:
+ username: ${{ secrets.DOCKER_USERNAME }}
+ password: ${{ secrets.DOCKER_PASSWORD }}
+
+ - name: Docker meta
+ id: meta
+ uses: docker/metadata-action@v3
+ with:
+ images: avenga/couper
+ tags: |
+ type=semver,pattern={{major}}.{{minor}}.{{patch}}
+ type=semver,pattern={{major}}.{{minor}}
+
+ - name: Build and push docker image with edge tag
if: github.event_name == 'push'
- # Recommended to refer to an explicit sha in combination with secrets
- uses: docker/build-push-action@92e71463491f2d026a477188b8ad3a0fdd9d672c #v1
+ uses: docker/build-push-action@v2
with:
- username: '${{ secrets.DOCKER_USERNAME }}'
- password: '${{ secrets.DOCKER_PASSWORD }}'
- repository: avenga/couper
- add_git_labels: true
+ labels: ${{ steps.meta.outputs.labels }}
tags: edge
+ push: true
+
- name: Build and push docker image with specific tag
if: github.event_name == 'release'
- # Recommended to refer to an explicit sha in combination with secrets
- uses: docker/build-push-action@92e71463491f2d026a477188b8ad3a0fdd9d672c #v1
+ uses: docker/build-push-action@v2
with:
- username: '${{ secrets.DOCKER_USERNAME }}'
- password: '${{ secrets.DOCKER_PASSWORD }}'
- repository: avenga/couper
- tag_with_ref: true
- add_git_labels: true
- tags: latest
+ labels: ${{ steps.meta.outputs.labels }}
+ tags: ${{ steps.meta.outputs.tags }}
push: ${{ startsWith(github.ref, 'refs/tags/') }}
+
- name: Docker Hub Description
if: github.event_name == 'release'
uses: peter-evans/dockerhub-description@v2
