41 lines
1.1 KiB
YAML
41 lines
1.1 KiB
YAML
name: Build & Deploy
|
||
|
||
# Fährt automatisch bei jedem Push auf main aus:
|
||
# Abhängigkeiten → Build → dist/ auf den VPS kopieren → Health-Check.
|
||
# Das dist/-Verzeichnis ist auf dem Web-Container als Laufzeit-Mount
|
||
# eingebunden (/opt/1bis8/web/dist), nginx pickt neue Dateien sofort auf.
|
||
|
||
on:
|
||
push:
|
||
branches: [main]
|
||
|
||
jobs:
|
||
deploy:
|
||
runs-on: docker
|
||
container:
|
||
image: node:22-alpine
|
||
# /opt/1bis8 des Hosts steht im Job als /deploy bereit (Whitelist im Runner)
|
||
options: -v /opt/1bis8:/deploy
|
||
steps:
|
||
- name: Checkout
|
||
uses: actions/checkout@v4
|
||
|
||
- name: Abhängigkeiten installieren
|
||
run: cd app && npm ci
|
||
|
||
- name: Build
|
||
run: cd app && npm run build
|
||
|
||
- name: Deploy auf 1bis.hocks.eu
|
||
run: |
|
||
rm -rf /deploy/web/dist/*
|
||
cp -a app/dist/. /deploy/web/dist/
|
||
|
||
- name: Health-Check
|
||
run: |
|
||
apk add --no-cache curl
|
||
sleep 3
|
||
curl -sf https://1bis.hocks.eu/ > /dev/null
|
||
curl -sf https://1bis8.hocks.eu/ > /dev/null
|
||
echo "1 bis 8 Party antwortet – Deploy erfolgreich"
|