Add action.yml
This commit is contained in:
+45
@@ -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"
|
||||
Reference in New Issue
Block a user