constellation/.github/actions/find_latest_image/action.yml
renovate[bot] d76c9ac82d
deps: update GitHub action dependencies (#3086)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-05-13 10:42:07 +02:00

77 lines
2.4 KiB
YAML

name: Find latest image
description: 'Find the latest image reference for a given ref/stream.'
inputs:
git-ref:
description: 'Git ref to checkout.'
imageVersion:
description: 'Image version to use. If set, no image will be searched for and the specified image will be returned.'
ref:
description: 'The ref the image was built on. (e.g. "main")'
default: 'main'
stream:
description: 'The publication stream of the image. (e.g. "debug")'
default: 'debug'
outputs:
image:
description: "Image reference to be used in the cluster."
value: ${{ steps.find-latest-image.outputs.output }}${{ steps.use-given-image.outputs.output }}
isDebugImage:
description: "Whether the image is a debug image."
value: ${{ steps.isDebugImage.outputs.isDebugImage }}
runs:
using: 'composite'
steps:
- name: Checkout head
if: inputs.imageVersion == '' && inputs.git-ref == 'head'
uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5
with:
ref: ${{ !github.event.pull_request.head.repo.fork && github.head_ref || '' }}
- name: Checkout ref
if: inputs.imageVersion == '' && inputs.git-ref != 'head'
uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5
with:
ref: ${{ inputs.git-ref }}
- name: Login to AWS
if: inputs.imageVersion == ''
uses: aws-actions/configure-aws-credentials@e3dd6a429d7300a6a4c196c26e071d42e0343502 # v4.0.2
with:
role-to-assume: arn:aws:iam::795746500882:role/GithubConstellationVersionsAPIRead
aws-region: eu-central-1
- name: Find latest image
id: find-latest-image
if: inputs.imageVersion == ''
uses: ./.github/actions/versionsapi
with:
command: latest
ref: ${{ inputs.ref }}
stream: ${{ inputs.stream }}
- name: Use given image
id: use-given-image
if: inputs.imageVersion != ''
shell: bash
run: |
echo "output=${{ inputs.imageVersion }}" | tee -a "$GITHUB_OUTPUT"
- name: Is debug image?
id: isDebugImage
shell: bash
run: |
case "${{ inputs.imageVersion }}" in
"")
echo "isDebugImage=true" | tee -a "$GITHUB_OUTPUT"
;;
*"/stream/debug/"*)
echo "isDebugImage=true" | tee -a "$GITHUB_OUTPUT"
;;
*)
echo "isDebugImage=false" | tee -a "$GITHUB_OUTPUT"
;;
esac