-
Notifications
You must be signed in to change notification settings - Fork 0
41 lines (36 loc) · 1.29 KB
/
deploy.yml
File metadata and controls
41 lines (36 loc) · 1.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
name: Dokploy Deployment Workflow
on:
workflow_dispatch:
workflow_run:
workflows: ["Build Docker Image"]
types:
- completed
branches: [main]
jobs:
deploy:
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' || github.event_name == 'push' || github.event_name == 'workflow_dispatch' }}
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Trigger Dokploy Deployment
run: |
response=$(curl -s -w "\n%{http_code}" -X 'POST' \
'${{ secrets.DOKPLOY_URL }}/api/trpc/application.deploy' \
-H 'accept: application/json' \
-H 'x-api-key: ${{ secrets.DOKPLOY_AUTH_TOKEN }}' \
-H 'Content-Type: application/json' \
-d '{
"json":{
"applicationId": "${{ secrets.DOKPLOY_APPLICATION_ID }}"
}
}')
body=$(echo "$response" | head -n -1)
http_code=$(echo "$response" | tail -n 1)
if [ "$http_code" -ge 200 ] && [ "$http_code" -lt 300 ]; then
echo "✅ Deployment triggered successfully!"
else
echo "❌ Deployment failed with HTTP status code: $http_code"
echo "Response: $body"
exit 1
fi