Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
IlyasMoutawwakil committed May 12, 2024
1 parent 6f308e4 commit 3f72e50
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions .github/workflows/build_and_publish_docker_images.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ on:
push:
branches:
- main
- build-and-publish-images
paths:
- .github/workflows/build_and_publish_docker_images.yaml
- docker/**
Expand Down Expand Up @@ -51,30 +50,32 @@ jobs:
username: ${{ github.actor }}
password: ${{ secrets.GH_TOKEN }}

# If pull request
# If main or schedule
- name: Extract metadata (tags, labels) for Docker
if: ${{ github.event_name == 'pull_request' }}
id: meta-pr
if: ${{ github.event_name == 'push' || github.event_name == 'schedule' }}
id: meta
uses: docker/metadata-action@v4
with:
flavor: |
latest=false
images: |
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=raw,value=pr-${{ github.event.pull_request.number }}-${{ matrix.flavor }}
type=raw,value=latest-${{ matrix.flavor }}
type=raw,value=sha-${{ github.sha }}-${{ matrix.flavor }}
# If main
# If pull request
- name: Extract metadata (tags, labels) for Docker
if: ${{ github.event_name == 'push' && github.ref == format('refs/heads/{0}', 'main') }}
id: meta
if: ${{ github.event_name == 'pull_request' }}
id: meta-pr
uses: docker/metadata-action@v4
with:
flavor: |
latest=false
images: |
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=raw,value=latest-${{ matrix.flavor }}
type=raw,value=pr-${{ github.event.pull_request.number }}-${{ matrix.flavor }}
type=raw,value=sha-${{ github.sha }}-${{ matrix.flavor }}
- name: Build and push Docker images
Expand All @@ -83,7 +84,7 @@ jobs:
with:
context: .
push: true
file: docker/${{ matrix.flavor }}/Dockerfile
tags: ${{ steps.meta.outputs.tags || steps.meta-pr.outputs.tags }}
labels: ${{ steps.meta.outputs.labels || steps.meta-pr.outputs.labels }}
file: docker/${{ matrix.flavor }}/Dockerfile
cache-from: type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest-${{ matrix.flavor }}

0 comments on commit 3f72e50

Please sign in to comment.