constellation/.github/actions/pick_azure_region/action.yml

43 lines
1.0 KiB
YAML
Raw Normal View History

2023-10-20 07:38:08 -04:00
name: Pick an Azure region
description: "Pick an Azure region"
inputs:
attestationVariant:
description: "Attestation variant to use. Not all regions support all variants."
required: true
2023-10-20 07:38:08 -04:00
outputs:
region:
description: "One of the supported Azure regions"
value: ${{ steps.pick-region.outputs.region }}
runs:
using: "composite"
steps:
- name: Pick a region
id: pick-region
shell: bash
run: |
possibleRegionsSNP=(
2023-10-20 07:38:08 -04:00
"westus"
"eastus"
"northeurope"
"westeurope"
"southeastasia"
)
possibleRegionsTDX=(
"centralus"
"eastus2"
"northeurope"
"westeurope"
)
if [[ "${{ inputs.attestationVariant }}" == "azure-tdx" ]]; then
possibleRegions=("${possibleRegionsTDX[@]}")
else
possibleRegions=("${possibleRegionsSNP[@]}")
fi
2023-10-20 07:38:08 -04:00
region=${possibleRegions[$RANDOM % ${#possibleRegions[@]}]}
echo "region=$region" | tee -a "$GITHUB_OUTPUT"