├── .github └── FUNDING.yml ├── LICENSE ├── action.yml └── readme.md /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | github: benbristow -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2024 Ben Bristow 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /action.yml: -------------------------------------------------------------------------------- 1 | name: "Dokploy Deployment" 2 | description: "Trigger a Dokploy deployment" 3 | branding: 4 | icon: 'upload-cloud' 5 | color: 'gray-dark' 6 | 7 | inputs: 8 | dokploy_url: 9 | description: "Dokploy base URL, e.g. https://dokploy.example.com" 10 | required: true 11 | api_token: 12 | description: 'Dokploy authentication token' 13 | required: true 14 | application_id: 15 | description: "Dokploy application/compose ID" 16 | required: true 17 | 18 | runs: 19 | using: "composite" 20 | steps: 21 | - name: Validate deployment type 22 | shell: bash 23 | run: | 24 | case "${{ inputs.service_type }}" in 25 | application|compose) 26 | echo "Valid service type: ${{ inputs.service_type }}" 27 | ;; 28 | *) 29 | echo "Invalid service type: ${{ inputs.service_type }}" 30 | exit 1 31 | ;; 32 | esac 33 | 34 | - name: Trigger Dokploy deployment 35 | shell: bash 36 | env: 37 | DOKPLOY_URL: ${{ inputs.dokploy_url }} 38 | DOKPLOY_API_TOKEN: ${{ inputs.api_token }} 39 | DOKPLOY_APPLICATION_ID: ${{ inputs.application_id }} 40 | run: | 41 | response=$(curl -X POST \ 42 | "$DOKPLOY_URL/api/${{ inputs.service_type }}.deploy" \ 43 | -H 'accept: application/json' \ 44 | -H "x-api-key:${DOKPLOY_API_TOKEN}" \ 45 | -H 'Content-Type: application/json' \ 46 | -H "Authorization: Bearer $DOKPLOY_AUTH_TOKEN" \ 47 | -d "{\"${{ inputs.service_type }}Id\": \"$DOKPLOY_APPLICATION_ID\"}" \ 48 | -w "%{http_code}" \ 49 | -o /dev/null \ 50 | -s) 51 | 52 | if [ "$response" -ne 200 ]; then 53 | echo "Deployment failed with status code: $response" 54 | exit 1 55 | else 56 | echo "Deployment triggered successfully with status code: $response" 57 | fi 58 | -------------------------------------------------------------------------------- /readme.md: -------------------------------------------------------------------------------- 1 | # Dokploy Deployment GitHub Action 2 | 3 | This GitHub Action triggers a deployment on your Dokploy instance as part of a CI/CD pipeline. 4 | 5 | --- 6 | 7 | ## Inputs 8 | 9 | ### `api_token` (required) 10 | 11 | The Dokploy authentication token. 12 | You can generate this under your Dokploy profile by clicking **Generate API Key**. 13 | 14 | ### `application_id` (required) 15 | 16 | The ID of your application in Dokploy. 17 | You can find this in the URL of your application. 18 | Example: 19 | If your application is located at `https://dokploy.example.com/dashboard/project/.../services/application/hdoihUG0FmYC8GdoFEc`, 20 | then your application ID is `hdoihUG0FmYC8GdoFEc`. 21 | 22 | ### `dokploy_url` (required) 23 | 24 | The base URL of your Dokploy instance, without a trailing slash. 25 | Example: `https://dokploy.example.com` 26 | 27 | ### `service_type` 28 | 29 | **Optional** Type of Dokploy service (`compose` or `application`) 30 | 31 | **Default** `application` 32 | 33 | ## Usage 34 | 35 | Include this action in your GitHub workflow file like this: 36 | 37 | ```yaml 38 | name: Dokploy Deployment Workflow 39 | 40 | on: [push] 41 | 42 | jobs: 43 | deploy: 44 | runs-on: ubuntu-latest 45 | steps: 46 | - name: Checkout code 47 | uses: actions/checkout@v4 48 | 49 | - name: Dokploy Deployment 50 | uses: benbristow/dokploy-deploy-action@0.2.0 51 | with: 52 | auth_token: ${{ secrets.DOKPLOY_AUTH_TOKEN }} 53 | application_id: ${{ secrets.DOKPLOY_APPLICATION_ID }} 54 | dokploy_url: ${{ secrets.DOKPLOY_URL }} 55 | service_type: application 56 | ``` 57 | Note: If you encounter persistent 403 errors, it might be related to Cloudflare bot detection blocking the requests, so it’s worth checking on that separately. 58 | 59 | ## Contributing 60 | 61 | Contributions are welcome! Please feel free to submit a pull request or open an issue for any bugs or feature requests. 62 | 63 | ## License 64 | 65 | This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details. 66 | --------------------------------------------------------------------------------