ci: despliegue por rama en <rama>.localesp.es (Gitea Actions + host runner)
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
name: deploy-branch
|
||||
|
||||
# CI/CD: cada push a cualquier rama se despliega en <rama>.localesp.es
|
||||
# Estrategia A — un entorno por rama. El registro DNS A es manual (precondición).
|
||||
# Detalles: docs/07-cicd.md
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- "**"
|
||||
delete:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
branch:
|
||||
description: "Rama a desplegar (vacío = la actual)"
|
||||
required: false
|
||||
default: ""
|
||||
|
||||
jobs:
|
||||
deploy:
|
||||
if: github.event_name != 'delete'
|
||||
runs-on: self-hosted
|
||||
timeout-minutes: 15
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Build (npm ci + vite build)
|
||||
run: |
|
||||
npm ci
|
||||
npm run build
|
||||
|
||||
- name: Deploy branch
|
||||
env:
|
||||
BRANCH: ${{ github.event.inputs.branch || github.ref_name }}
|
||||
run: bash scripts/deploy.sh "$BRANCH"
|
||||
|
||||
# Al borrar una rama, se limpia su entorno
|
||||
teardown:
|
||||
if: github.event_name == 'delete'
|
||||
runs-on: self-hosted
|
||||
timeout-minutes: 5
|
||||
steps:
|
||||
- name: Checkout (default branch, trae scripts/)
|
||||
uses: actions/checkout@v4
|
||||
- name: Teardown branch env
|
||||
env:
|
||||
# github.event.ref en un 'delete' es refs/heads/<rama>
|
||||
BRANCH: ${{ github.event.ref }}
|
||||
run: bash scripts/teardown.sh "${BRANCH#refs/heads/}"
|
||||
Reference in New Issue
Block a user