Files
ci-templates/.gitea/workflows/deploy-compose.reusable.yml

59 lines
1.8 KiB
YAML

name: Deploy (Compose)
"on":
workflow_call:
inputs:
runner:
description: "Single runner label (example: ubuntu-latest or self-hosted)"
required: true
type: string
runner_json:
description: "Optional JSON array of runner labels (example: [\"self-hosted\",\"prod\"]). If set, overrides runner."
required: false
type: string
default: ""
image:
description: Image reference to deploy (registry/repo:tag or @sha256)
required: true
type: string
workdir:
description: Directory containing compose files on the target runner
required: false
type: string
default: .
compose_args:
description: Arguments after `docker compose`
required: false
type: string
default: up -d --pull always --remove-orphans
jobs:
deploy:
runs-on: ${{ inputs.runner_json != '' && fromJSON(inputs.runner_json) || inputs.runner }}
steps:
# Required for local action usage: `uses: ./.github/actions/...`
- name: Checkout
uses: actions/checkout@v4
- name: Show target server (Linux/macOS)
if: runner.os != 'Windows'
shell: bash
run: |
echo "Deploying on runner: ${{ inputs.runner }}"
echo "Image: ${{ inputs.image }}"
- name: Show target server (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
Write-Output "Deploying on runner: ${{ inputs.runner }}"
Write-Output "Image: ${{ inputs.image }}"
- name: Compose Up
uses: tienngo/ci-templates/.gitea/actions/compose-up@main
with:
image: ${{ inputs.image }}
workdir: ${{ inputs.workdir }}
compose_args: ${{ inputs.compose_args }}