Skip to content

Commit 07bac06

Browse files
Implement Consistent Versioning and Tagging for Accelerator Images (#288)
1 parent b785eb6 commit 07bac06

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

.github/workflows/build-docker.yml

+7-3
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,17 @@ jobs:
4848
id: date
4949
run: echo "date=$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT
5050

51+
- name: Determine Tag Name Based on Branch
52+
id: determine_tag
53+
run: echo "tagname=${{ github.ref_name == 'main' && 'latest' || github.ref_name == 'dev' && 'dev' || github.ref_name == 'demo' && 'demo' || github.head_ref || 'default' }}" >> $GITHUB_OUTPUT
54+
5155
- name: Build Docker Image and optionally push
5256
uses: docker/build-push-action@v6
5357
with:
5458
context: .
5559
file: ${{ inputs.dockerfile }}
5660
push: ${{ inputs.push }}
57-
cache-from: type=registry,ref=${{ inputs.registry }}/${{ inputs.app_name}}:${{ github.ref_name == 'main' && 'latest' || github.ref_name == 'dev' && 'dev' || github.ref_name == 'demo' && 'demo' || 'latest' }}
61+
cache-from: type=registry,ref=${{ inputs.registry }}/${{ inputs.app_name}}:${{ steps.determine_tag.outputs.tagname }}
5862
tags: |
59-
${{ inputs.registry }}/${{ inputs.app_name}}:${{ github.ref_name == 'main' && 'latest' || github.ref_name == 'dev' && 'dev' || github.ref_name == 'demo' && 'demo' || 'latest' }}
60-
${{ inputs.registry }}/${{ inputs.app_name}}:${{ steps.date.outputs.date }}_${{ github.run_number }}
63+
${{ inputs.registry }}/${{ inputs.app_name}}:${{ steps.determine_tag.outputs.tagname }}
64+
${{ inputs.registry }}/${{ inputs.app_name}}:${{ steps.determine_tag.outputs.tagname }}_${{ steps.date.outputs.date }}_${{ github.run_number }}

0 commit comments

Comments
 (0)