Deploy Dokploy applications from GitHub and Gitea Actions
A dependency-free node20 action that triggers application.deploy or compose.deploy, then follows the deployment to a terminal status so a failed build fails the CI run. Snapshots the deployment list before triggering, so a concurrent deployment is never mistaken for this one. Optionally points the application at a freshly built image first, which is what lets a workflow lint, test, push and deploy the same artifact.
This commit is contained in:
43
examples/manual-promote.yml
Normal file
43
examples/manual-promote.yml
Normal file
@@ -0,0 +1,43 @@
|
||||
# Promote an already-built image to an environment on demand, and roll back the
|
||||
# same way. Nothing is rebuilt: the tag chosen here is one CI has already
|
||||
# tested and pushed.
|
||||
|
||||
name: promote
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
environment:
|
||||
description: Dokploy environment to deploy to
|
||||
type: choice
|
||||
options: [staging, production]
|
||||
default: staging
|
||||
tag:
|
||||
description: Image tag to promote, e.g. a short commit SHA
|
||||
required: true
|
||||
|
||||
jobs:
|
||||
promote:
|
||||
runs-on: ubuntu-latest
|
||||
environment: ${{ inputs.environment }}
|
||||
steps:
|
||||
- id: deploy
|
||||
uses: maxvojtkov/dokploy-deploy-action@v1
|
||||
with:
|
||||
host: ${{ secrets.DOKPLOY_HOST }}
|
||||
api-key: ${{ secrets.DOKPLOY_API_KEY }}
|
||||
project: shop
|
||||
service: api
|
||||
environment: ${{ inputs.environment }}
|
||||
docker-image: ghcr.io/acme/api:${{ inputs.tag }}
|
||||
title: Promote ${{ inputs.tag }} to ${{ inputs.environment }}
|
||||
# Print the build log either way, since a human is watching.
|
||||
logs: always
|
||||
timeout: 900
|
||||
|
||||
- name: Announce
|
||||
if: always()
|
||||
run: |
|
||||
echo "deployment ${{ steps.deploy.outputs.deployment-id }}" \
|
||||
"finished with status ${{ steps.deploy.outputs.status }}" \
|
||||
"in ${{ steps.deploy.outputs.duration }}s"
|
||||
Reference in New Issue
Block a user