Dokploy Deployment Workflow #63
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |