feat: new ssh-deploy job

This commit is contained in:
2026-07-10 07:19:53 -03:00
parent 5c11a6cf44
commit 586ba48de7
2 changed files with 140 additions and 0 deletions

View File

@@ -70,6 +70,38 @@ jobs:
| `namespace` | ❌ | `default` | Kubernetes namespace |
| `kube_version` | ❌ | `stable` | kubectl version (`stable` or e.g. `v1.31.0`) |
### `ssh-deploy`
SSH into a remote host and run `docker compose pull` + `docker compose up -d --force-recreate` to deploy the latest images. No third-party SSH action — uses native `ssh` and `ssh-keyscan`.
```yaml
jobs:
deploy:
runs-on: ubuntu-amd64
needs: build
steps:
- uses: ivanch/pipeline-actions/ssh-deploy@main
with:
ssh_host: ${{ secrets.DEPLOY_HOST }}
ssh_username: ${{ secrets.DEPLOY_USERNAME }}
ssh_key: ${{ secrets.DEPLOY_KEY }}
remote_dir: ${{ secrets.DEPLOY_DIR }}
# optional:
# ssh_port: "22"
# compose_files: docker-compose.yml compose.override.yml
```
| Input | Required | Default | Description |
|---|---|---|---|
| `ssh_host` | ✅ | — | Remote server hostname or IP |
| `ssh_username` | ✅ | — | SSH username |
| `ssh_key` | ✅ | — | SSH private key (use secrets) |
| `remote_dir` | ✅ | — | Directory on the remote server with `docker-compose.yml` |
| `ssh_port` | ❌ | `22` | SSH port |
| `compose_files` | ❌ | _(empty)_ | Space-separated compose file paths (applied via `-f` flags; when empty docker compose uses default detection) |
---
## Required Secrets
Consumer repositories need these secrets configured in Gitea:
@@ -79,3 +111,7 @@ Consumer repositories need these secrets configured in Gitea:
| `REGISTRY_PASSWORD` | `build-and-push` | Container registry password/token |
| `SSH_KEY_DOCKERBUILD` | `build-and-push` | SSH private key for `docker-build.haven` |
| `KUBE_CONFIG` | `deploy-restart` | Full kubeconfig YAML for cluster access |
| `DEPLOY_HOST` | `ssh-deploy` | Remote server hostname or IP |
| `DEPLOY_USERNAME` | `ssh-deploy` | SSH username for the remote server |
| `DEPLOY_KEY` | `ssh-deploy` | SSH private key for the remote server |
| `DEPLOY_DIR` | `ssh-deploy` | Directory on the remote server with `docker-compose.yml` |