This action allows to you deploy any kind of compose definition to a server. The action connects to the server using SSH, initialized Docker Swarm, deploys your compose definition and cleans up unused images and containers afterward.
Below you can find an example workflow on how to deploy your application using our deployment action. We assume that a connection to your server is possible with an SSH key. Password authentication is not supported.
name: Deploy to productionon:
workflow_dispatch:
jobs:
deploy:
runs-on: "ubuntu-latest"permissions:
deployments: writesteps:
- name: Checkout codeuses: actions/checkout@v4
- name: Login to Docker Hubuses: docker/login-action@v3with:
username: ${{ secrets.REGISTRY_USERNAME }}password: ${{ secrets.REGISTRY_TOKEN }}
- name: Install SSH keyuses: shimataro/ssh-key-action@v2with:
key: ${{ secrets.DEPLOY_SSH_KEY }}known_hosts: ${{ secrets.KNOWN_HOSTS }}
- name: Deploy to productionuses: simplificator/deploy-action@mainwith:
compose-file: docker-compose.ymlenvironment: productionenvironment-url: https://example.comstack-name: my-appssh-user-at-host: deployer@123.124.125.126secrets: | - name: secret value: ${{ secrets.SECRET }}| Name | Description |
|---|---|
compose-file | Path to your docker compose definition inside the repository. |
environment | The name of the environment for the deployment (optional). Used to create a GitHub deployment. |
environment-url | A URL to access your deployment (optional). Used to create a GitHub deployment. |
secrets | Allows to define a YAML array of Docker secrets which should be created (optional). You need to define it as a multiline YAML string, as this is technically not supported by Actions directly. |
stack-name | Name of the Docker Stack that shoud be created on your server. |
ssh-user-at-host | User@host to connect to (e.g. hello@myhost.com) |
ssh-port | SSH port to connect to. Defaults to 22 if not defined. |
MIT / BSD