Añade la automatización de despliegue a esta rama (no la tenía):
- .gitea/workflows/deploy.yml: build + deploy on push, teardown on delete.
- scripts/lib/env.sh + deploy.sh + teardown.sh: lib OOP (Env + SystemdUnit/
NginxVhost/TlsCert) y entrypoints finos.
El código de la app NO se modifica. Traído path-scoped desde master (6cc326e).
Cada push a prototipo-yb01 publicará la app en prototipo-yb01.localesp.es.
34 lines
723 B
Bash
Executable File
34 lines
723 B
Bash
Executable File
#!/usr/bin/env bash
|
|
# deploy.sh — Despliega la rama actual a <slug>.localesp.es
|
|
# Toda la lógica vive en lib/env.sh (modelo OOP). Éste es sólo el entrypoint.
|
|
set -euo pipefail
|
|
|
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
# shellcheck source=lib/env.sh
|
|
. "$SCRIPT_DIR/lib/env.sh"
|
|
|
|
usage() {
|
|
echo "usage: $0 <branch>" >&2
|
|
exit 2
|
|
}
|
|
|
|
main() {
|
|
local branch root
|
|
|
|
branch="${1:-${GITHUB_REF_NAME:-}}"
|
|
if [ -z "$branch" ]; then
|
|
usage
|
|
fi
|
|
root="$(cd "$SCRIPT_DIR/.." && pwd)"
|
|
|
|
Logger::set_tag deploy
|
|
Env::new env "$branch" "$root"
|
|
Logger::info "$(Env::banner env)"
|
|
|
|
Env::deploy env
|
|
|
|
Logger::info "LISTO: $(Env::url env) ($(Env::summary env))"
|
|
}
|
|
|
|
main "$@"
|