Skip to content

Commit

Permalink
[Fix] Label docker image latest only if comes from main branch
Browse files Browse the repository at this point in the history
  • Loading branch information
blcham committed May 6, 2024
1 parent 4c1c13d commit 0d24780
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,18 @@ name: Docker Image CI

on:
push:
branches: [ main ]
branches: [main]
pull_request:
branches: [ main ]
branches: [main]
workflow_dispatch:

env:
REGISTRY: ghcr.io

jobs:

build:
# Skip if PR is from a fork
if: github.event_name != 'pull_request' || github.event.repository.full_name == github.event.pull_request.head.repo.full_name

runs-on: ubuntu-latest
permissions:
Expand All @@ -34,12 +36,12 @@ jobs:
with:
images: ${{ env.REGISTRY }}/${{ github.repository }}
flavor: |
latest=true
${{ github.ref == 'refs/heads/main' && 'latest=true' || '' }}
- name: Build and push Docker image
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
labels: ${{ steps.meta.outputs.labels }}

0 comments on commit 0d24780

Please sign in to comment.