Add .gitea/workflows/deploy-compose.reusable.yml
This commit is contained in:
58
.gitea/workflows/deploy-compose.reusable.yml
Normal file
58
.gitea/workflows/deploy-compose.reusable.yml
Normal file
@@ -0,0 +1,58 @@
|
|||||||
|
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: ./.gitea/actions/compose-up
|
||||||
|
with:
|
||||||
|
image: ${{ inputs.image }}
|
||||||
|
workdir: ${{ inputs.workdir }}
|
||||||
|
compose_args: ${{ inputs.compose_args }}
|
||||||
Reference in New Issue
Block a user