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@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 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@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 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