Skip to content

Commit

Permalink
ci: Adjust logic for determining build tag
Browse files Browse the repository at this point in the history
This commit adjusts the logic used to determine the image tag in the
build workflow. Previously, only the SHA of built ref was used,
requiring image tags in manifests to be manually updated. This commit
will use the 'latest' tag instead if the ref being built is on the main
branch.

Signed-off-by: Ryan Drew <[email protected]>
  • Loading branch information
learnitall committed Aug 16, 2024
1 parent e257167 commit 7267554
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,17 @@ jobs:
with:
persist-credentials: false

- name: Generate image tags
id: tag
run: |
if [[ "${{ github.event_name }}" == "push" && "${{ github.ref_name }}" == "main" && "${{ github.repository }}" == "cilium/cilium" ]]; then
tag="latest"
else
tag="${{ github.event.pull_request.head.sha || github.sha }}"
fi
echo "tag=quay.io/${{ github.repository_owner }}/${{ matrix.name }}:${tag}" >> $GITHUB_OUTPUT
- name: Build and Push
uses: docker/build-push-action@16ebe778df0e7752d2cfcbd924afdbbd89c1a755 # v6.6.1
with:
Expand All @@ -84,4 +95,4 @@ jobs:
push: ${{ github.event_name == 'push' }}
platforms: linux/amd64,linux/arm64
tags: |
quay.io/${{ github.repository_owner }}/${{ matrix.name }}:${{ github.event.pull_request.head.sha || github.sha }}
${{ steps.tag.outputs.tag }}

0 comments on commit 7267554

Please sign in to comment.