diff --git a/.github/workflows/docker-compose-publish.yml b/.github/workflows/docker-compose-publish.yml index 3bdcdaa..c53eb35 100644 --- a/.github/workflows/docker-compose-publish.yml +++ b/.github/workflows/docker-compose-publish.yml @@ -26,6 +26,26 @@ jobs: - name: Set up Docker Buildx uses: docker/setup-buildx-action@v1 + - name: Docker meta + id: meta + uses: docker/metadata-action@v3 + with: + # list of Docker images to use as base name for tags + images: | + ${{ github.repository }}_app1 + ${{ github.repository }}_app2 + ${{ env.REGISTRY }}/${{ github.repository }}_app1 + ${{ env.REGISTRY }}/${{ github.repository }}_app2 + # generate Docker tags based on the following events/attributes + tags: | + type=schedule + type=ref,event=branch + type=ref,event=pr + type=semver,pattern={{version}} + type=semver,pattern={{major}}.{{minor}} + type=semver,pattern={{major}} + type=sha + - name: Cache Docker layers uses: actions/cache@v2 with: @@ -53,7 +73,8 @@ jobs: load: true push: false builder: ${{ steps.buildx.outputs.name }} - tags: ${{ env.REGISTRY }}/${{ github.repository }}_app1:${{ github.event.release.tag_name }} + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} cache-from: type=local,src=/tmp/.buildx-cache cache-to: type=local,mode=max,dest=/tmp/.buildx-cache-new @@ -65,7 +86,8 @@ jobs: load: true push: false builder: ${{ steps.buildx.outputs.name }} - tags: ${{ env.REGISTRY }}/${{ github.repository }}_app2:${{ github.event.release.tag_name }} + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} cache-from: type=local,src=/tmp/.buildx-cache cache-to: type=local,mode=max,dest=/tmp/.buildx-cache-new