From a199075e88bfd6657e0b1700af77ab6779509993 Mon Sep 17 00:00:00 2001 From: KartoffelChipss <4+kartoffelchipss@noreply.git.fish> Date: Thu, 7 May 2026 16:30:18 +0200 Subject: [PATCH] Add action.yml --- action.yml | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 action.yml diff --git a/action.yml b/action.yml new file mode 100644 index 0000000..f1396ca --- /dev/null +++ b/action.yml @@ -0,0 +1,45 @@ +name: 'Quay Deployment' +description: 'Triggers a deployment on Quay' + +inputs: + DEPLOY_TOKEN: + description: 'Bearer token for Quay API' + required: true + SITE_ID: + description: 'The site UUID to deploy' + required: true + BASE_URL: + description: 'Quay base URL' + required: true + +runs: + using: 'composite' + steps: + - name: Trigger deployment + shell: bash + run: | + BASE_URL="${{ inputs.BASE_URL }}" + + # Strip trailing slashes + BASE_URL="${BASE_URL%/}" + + # Add https:// if no protocol provided + if [[ "$BASE_URL" != http://* && "$BASE_URL" != https://* ]]; then + BASE_URL="https://${BASE_URL}" + fi + + RESPONSE=$(curl -sS -X POST \ + "${BASE_URL}/api/v1/deploy?site=${{ inputs.SITE_ID }}" \ + -H "Authorization: Bearer ${{ inputs.DEPLOY_TOKEN }}" \ + -w "\n%{http_code}") + + HTTP_STATUS=$(echo "$RESPONSE" | tail -n1) + BODY=$(echo "$RESPONSE" | head -n -1) + + if [[ "$HTTP_STATUS" -lt 200 || "$HTTP_STATUS" -gt 299 ]]; then + echo "Deployment failed with status: $HTTP_STATUS" + echo "Response: $BODY" + exit 1 + fi + + echo "Deployment succeeded with status: $HTTP_STATUS" \ No newline at end of file