Skip to content

Commit

Permalink
Update image-build.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
georgepstaylor committed Sep 20, 2024
1 parent 7cf703a commit 26ecb3c
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions .github/workflows/image-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,22 @@ jobs:
- name: Create safe tag for image
id: safe_tag
run: |
if "${{ github.event_name }}" == "pull_request"; then
if ["${{ github.event_name }}" == "pull_request"]; then
echo "SAFE_TAG=$(echo ${{ github.event.pull_request.head.ref }} | sed 's/[^a-zA-Z0-9.]/-/g')-${{ github.run_id }}-${{ github.run_number }}" >> $GITHUB_OUTPUT
else
echo "SAFE_TAG=$(echo ${{ github.ref_name }} | sed 's/[^a-zA-Z0-9.]/-/g')" >> $GITHUB_OUTPUT
fi
- name: Output VERSION_REF
id: output_version_ref
run: |
if ["${{ github.event_name }}" == "pull_request"]; then
# if on a PR we need to get the current branch name
echo "VERSION_REF=${{ github.event.pull_request.head.ref }}" >> $GITHUB_OUTPUT
else
echo "VERSION_REF=${{ github.ref_name }}" >> $GITHUB_OUTPUT
fi
- name: Set up Docker Buildx
id: setup_buildx
uses: docker/setup-buildx-action@v3
Expand All @@ -55,7 +65,7 @@ jobs:
push: true
tags: ghcr.io/ministryofjustice/hmpps-ldap-automation:${{ steps.safe_tag.outputs.SAFE_TAG }}
build-args: |
VERSION_REF=${{ steps.BumpVersionAndPushTag.outputs.new_tag }}
VERSION_REF=${{ steps.output_version_ref.outputs.VERSION_REF }}
- name: Comment image tag on PR
if: github.event_name == 'pull_request'
Expand Down

0 comments on commit 26ecb3c

Please sign in to comment.