fix version getter
All checks were successful
Test STACKIT Auth Action / test (push) Successful in 54s
All checks were successful
Test STACKIT Auth Action / test (push) Successful in 54s
This commit is contained in:
parent
2b97001a94
commit
f3a84f1c5b
1 changed files with 12 additions and 14 deletions
26
action.yml
26
action.yml
|
|
@ -30,12 +30,6 @@ runs:
|
|||
run: |
|
||||
VERSION="${{ inputs.cli-version }}"
|
||||
|
||||
if [ "$VERSION" = "latest" ]; then
|
||||
VERSION=$(curl -s https://api.github.com/repos/stackitcloud/stackit-cli/releases/latest | jq -r '.tag_name')
|
||||
else
|
||||
VERSION="v$VERSION"
|
||||
fi
|
||||
|
||||
# Detect OS
|
||||
OS=$(uname -s | tr '[:upper:]' '[:lower:]')
|
||||
case "$OS" in
|
||||
|
|
@ -56,15 +50,22 @@ runs:
|
|||
EXT="tar.gz"
|
||||
if [ "$OS" = "windows" ]; then EXT="zip"; fi
|
||||
|
||||
URL="https://github.com/stackitcloud/stackit-cli/releases/download/${VERSION}/stackit-cli_${VERSION}_${OS}_${ARCH}.${EXT}"
|
||||
if [ "$VERSION" = "latest" ]; then
|
||||
TAG=$(curl -sL https://api.github.com/repos/stackitcloud/stackit-cli/releases/latest | jq -r '.tag_name')
|
||||
VERSION=${TAG#v}
|
||||
else
|
||||
TAG="v$VERSION"
|
||||
fi
|
||||
|
||||
echo "Downloading STACKIT CLI ${VERSION} for ${OS}/${ARCH}..."
|
||||
URL="https://github.com/stackitcloud/stackit-cli/releases/download/${TAG}/stackit-cli_${VERSION}_${OS}_${ARCH}.${EXT}"
|
||||
|
||||
echo "Downloading STACKIT CLI ${TAG} for ${OS}/${ARCH}..."
|
||||
if [ "$OS" = "windows" ]; then
|
||||
curl -sL "$URL" -o stackit.zip
|
||||
curl -sfL "$URL" -o stackit.zip
|
||||
unzip -q stackit.zip
|
||||
rm stackit.zip
|
||||
else
|
||||
curl -sL "$URL" | tar -xz
|
||||
curl -sfL "$URL" | tar -xz
|
||||
fi
|
||||
|
||||
if [ ! -f stackit ] && [ ! -f stackit.exe ]; then
|
||||
|
|
@ -97,13 +98,10 @@ runs:
|
|||
SA_KEY_FILE=$(mktemp)
|
||||
echo "$SA_KEY" > "$SA_KEY_FILE"
|
||||
|
||||
# Configure the CLI to use the service account key
|
||||
export STACKIT_SERVICE_ACCOUNT_KEY_PATH="$SA_KEY_FILE"
|
||||
|
||||
echo "Authenticating and retrieving access token..."
|
||||
|
||||
# Construct command
|
||||
CMD="stackit auth activate-service-account --only-print-access-token"
|
||||
CMD="stackit auth activate-service-account --service-account-key-path $SA_KEY_FILE --only-print-access-token"
|
||||
if [ -n "$PROJECT_ID" ]; then
|
||||
CMD="$CMD --project-id $PROJECT_ID"
|
||||
fi
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue