Vigiar
1
0
Derivar
Você já tinha feito uma derivação do repositório deploy-on-vps, anteriormente
0
deploy-on-vps/action.yml
2026-11-28 15:28:01 +02:00

118 linhas
4,2 KiB
YAML

name: "Interweb Angola deploy on VPS"
description: "Publish your site on a Interweb Angola VPS: finds the server through the API and copies the files with rsync over SSH."
author: "Interweb Angola"
branding:
icon: "upload-cloud"
color: "blue"
inputs:
api-key:
description: "Your Interweb Angola API key, with vps:read (and vps:write for start-if-stopped). Keep it in a secret. If empty, the INTERWEB_API_KEY environment variable is used."
required: false
default: ""
server-id:
description: "The id of the VPS (the same as its service id). Empty: uses server-name, or the only active VPS of the account."
required: false
default: ""
server-name:
description: "The name (hostname) or the IP of the VPS, when you do not give server-id."
required: false
default: ""
ssh-private-key:
description: "The private SSH key that can log in to the VPS. Keep it in a secret."
required: true
ssh-user:
description: "The SSH user on the VPS."
required: false
default: "root"
ssh-port:
description: "The SSH port of the VPS."
required: false
default: "22"
known-hosts:
description: "The known_hosts line(s) of the VPS (ssh-keyscan -p PORT IP). Recommended. Empty trusts the host key shown at deploy time."
required: false
default: ""
host:
description: "Address to connect to, such as a hostname or an additional IP. Empty uses the main IP of the VPS from the API."
required: false
default: ""
source:
description: "The folder of the repository to publish, such as ./public or ./dist."
required: false
default: "."
target:
description: "The folder on the VPS that receives the files, such as /var/www/html."
required: true
delete:
description: "true deletes files on the VPS that are not in source."
required: false
default: "false"
exclude:
description: "Paths to leave out, one per line (rsync patterns). .git/ and .github/ are always left out."
required: false
default: ""
rsync-options:
description: "Extra rsync options, such as --chmod=D755,F644."
required: false
default: ""
pre-command:
description: "Command to run on the VPS, inside target, before copying."
required: false
default: ""
post-command:
description: "Command to run on the VPS, inside target, after copying, such as a service reload."
required: false
default: ""
start-if-stopped:
description: "true starts the VPS through the API when it is stopped, and waits for it."
required: false
default: "false"
wait-timeout:
description: "Seconds to wait for the VPS to be running."
required: false
default: "600"
dry-run:
description: "true shows what would be copied without copying."
required: false
default: "false"
outputs:
server-id:
description: "The id of the VPS that received the deploy."
value: ${{ steps.deploy.outputs.server-id }}
server-name:
description: "The name of the VPS."
value: ${{ steps.deploy.outputs.server-name }}
ip:
description: "The main IP of the VPS."
value: ${{ steps.deploy.outputs.ip }}
power-state:
description: "The state of the VPS before the copy, such as running."
value: ${{ steps.deploy.outputs.power-state }}
runs:
using: "composite"
steps:
- id: deploy
shell: bash
env:
INPUT_API_KEY: ${{ inputs.api-key }}
INPUT_SERVER_ID: ${{ inputs.server-id }}
INPUT_SERVER_NAME: ${{ inputs.server-name }}
INPUT_SSH_PRIVATE_KEY: ${{ inputs.ssh-private-key }}
INPUT_SSH_USER: ${{ inputs.ssh-user }}
INPUT_SSH_PORT: ${{ inputs.ssh-port }}
INPUT_KNOWN_HOSTS: ${{ inputs.known-hosts }}
INPUT_HOST: ${{ inputs.host }}
INPUT_SOURCE: ${{ inputs.source }}
INPUT_TARGET: ${{ inputs.target }}
INPUT_DELETE: ${{ inputs.delete }}
INPUT_EXCLUDE: ${{ inputs.exclude }}
INPUT_RSYNC_OPTIONS: ${{ inputs.rsync-options }}
INPUT_PRE_COMMAND: ${{ inputs.pre-command }}
INPUT_POST_COMMAND: ${{ inputs.post-command }}
INPUT_START_IF_STOPPED: ${{ inputs.start-if-stopped }}
INPUT_WAIT_TIMEOUT: ${{ inputs.wait-timeout }}
INPUT_DRY_RUN: ${{ inputs.dry-run }}
run: bash "$GITHUB_ACTION_PATH/deploy.sh"