Skip to content

Commit

Permalink
Merge pull request #79 from Kuadrant/build-image-fix-for-branches
Browse files Browse the repository at this point in the history
docker image with git sha only for pushes on main branch
  • Loading branch information
eguzki authored Sep 3, 2024
2 parents 354dd42 + 6603619 commit 7be8fe3
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions .github/workflows/build-image.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@ on:
push:
branches: ['*']
tags: ['*']
workflow_dispatch: {}

env:
IMG_TAGS: ${{ github.sha }} ${{ github.ref_name }}
IMG_TAGS: ${{ github.ref_name }}
IMG_REGISTRY_HOST: quay.io
IMG_REGISTRY_ORG: kuadrant
MAIN_BRANCH_NAME: main
Expand All @@ -19,11 +20,16 @@ jobs:
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Add latest tag
- name: Add latest tag for the main branch
if: ${{ github.ref_name == env.MAIN_BRANCH_NAME }}
id: add-latest-tag
run: |
echo "IMG_TAGS=latest ${{ env.IMG_TAGS }}" >> $GITHUB_ENV
- name: Add git sha tag for the main branch
if: ${{ github.ref_name == env.MAIN_BRANCH_NAME }}
id: add-git-sha-tag
run: |
echo "IMG_TAGS=${{ github.sha }} ${{ env.IMG_TAGS }}" >> $GITHUB_ENV
- name: Build Image
id: build-image
uses: redhat-actions/buildah-build@v2
Expand Down

0 comments on commit 7be8fe3

Please sign in to comment.