mirror of
https://github.com/edgelesssys/constellation.git
synced 2024-10-01 01:36:09 -04:00
576b48c8b7
Co-authored-by: Paul Meyer <49727155+katexochen@users.noreply.github.com>
79 lines
2.6 KiB
YAML
79 lines
2.6 KiB
YAML
name: Select image
|
|
description: Resolve string presets and shortpaths to shortpaths only
|
|
|
|
inputs:
|
|
osImage:
|
|
description: "Shortpath or main-debug or release-stable"
|
|
required: true
|
|
|
|
outputs:
|
|
osImage:
|
|
description: "Shortpath of for input string, original input if that was already a shortpath"
|
|
value: ${{ steps.set-output.outputs.osImage }}
|
|
isDebugImage:
|
|
description: "Input represents a debug image or not"
|
|
value: ${{ steps.set-output.outputs.isDebugImage }}
|
|
|
|
runs:
|
|
using: "composite"
|
|
steps:
|
|
- name: Login to AWS
|
|
uses: aws-actions/configure-aws-credentials@5fd3084fc36e372ff1fff382a39b10d03659f355 # v2.2.0
|
|
with:
|
|
role-to-assume: arn:aws:iam::795746500882:role/GithubConstellationVersionsAPIRead
|
|
aws-region: eu-central-1
|
|
|
|
- name: Input is preset
|
|
id: input-is-preset
|
|
shell: bash
|
|
run: |
|
|
if [[ "${{ inputs.osImage }}" == "ref/main/stream/debug/?" || "${{ inputs.osImage }}" == "ref/release/stream/stable/?" ]]; then
|
|
echo "result=true" | tee -a "$GITHUB_OUTPUT"
|
|
else
|
|
echo "result=false" | tee -a "$GITHUB_OUTPUT"
|
|
fi
|
|
|
|
- name: Separate ref and stream from matrix
|
|
if: steps.input-is-preset.outputs.result == 'true'
|
|
id: separate-ref-stream
|
|
env:
|
|
REFSTREAM: ${{ inputs.osImage }}
|
|
shell: bash
|
|
run: |
|
|
echo "ref=$(echo $REFSTREAM | cut -d/ -f2)" | tee -a "$GITHUB_OUTPUT"
|
|
echo "stream=$(echo $REFSTREAM | cut -d/ -f4)" | tee -a "$GITHUB_OUTPUT"
|
|
|
|
- name: Find latest image
|
|
if: steps.input-is-preset.outputs.result == 'true'
|
|
id: find-latest-image
|
|
uses: ./.github/actions/versionsapi
|
|
with:
|
|
command: latest
|
|
ref: ${{ steps.separate-ref-stream.outputs.ref == 'release' && '-' || steps.separate-ref-stream.outputs.ref }}
|
|
stream: ${{ steps.separate-ref-stream.outputs.stream }}
|
|
|
|
- name: Set outputs
|
|
id: set-output
|
|
shell: bash
|
|
run: |
|
|
if [[ ${{ steps.input-is-preset.outputs.result }} == "true" ]]
|
|
then
|
|
export IMAGE=${{ steps.find-latest-image.outputs.output }}
|
|
else
|
|
export IMAGE=${{ inputs.osImage }}
|
|
fi
|
|
|
|
echo "osImage=$IMAGE" | tee -a "$GITHUB_OUTPUT"
|
|
echo "Using image: $IMAGE"
|
|
|
|
case "$IMAGE" in
|
|
*"/stream/debug/"*)
|
|
echo "isDebugImage=true" | tee -a "$GITHUB_OUTPUT"
|
|
echo "Image is debug image."
|
|
;;
|
|
*)
|
|
echo "isDebugImage=false" | tee -a "$GITHUB_OUTPUT"
|
|
echo "Image is not debug image."
|
|
;;
|
|
esac
|