Files
mytimetracker/.gitea/workflows/buildAndDeply.yaml
nilzbu f24fef9b16
Some checks failed
Build-und-Deploy / build (push) Failing after 1m34s
pipeline
2025-08-09 19:21:01 +02:00

69 lines
2.3 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
name: Build-und-Deploy
on:
push:
branches: [ master ]
jobs:
build:
runs-on: ubuntu-latest
container:
image: ci-java21-node20:latest
steps:
- name: Map gitea into /etc/hosts (ohne ip)
shell: bash
run: |
set -euo pipefail
gw_hex="$(awk '$2=="00000000" {print $3; exit}' /proc/net/route || true)"
if [ -n "${gw_hex:-}" ]; then
gw="$(printf "%d.%d.%d.%d" 0x${gw_hex:6:2} 0x${gw_hex:4:2} 0x${gw_hex:2:2} 0x${gw_hex:0:2})"
else
gw="172.17.0.1"
fi
echo "$gw gitea" >> /etc/hosts
getent hosts gitea || true
- name: Checkout
uses: actions/checkout@v4
- name: 🧰 Gradle vorbereiten & Version
shell: bash
run: |
set -euxo pipefail
test -f ./gradlew || { echo "gradlew fehlt bitte lokal 'gradle wrapper' ausführen und committen."; exit 1; }
chmod +x ./gradlew
./gradlew --version
- name: 🏗️ Build Backend + Vaadin (Production)
shell: bash
run: |
set -euxo pipefail
# Vaadin im Production-Mode bündeln
./gradlew clean build -x test --no-daemon -Pvaadin.productionMode
ls -al build/libs
JAR="$(ls -1 build/libs/*.jar | head -n1)"
echo "Gebautes JAR: $JAR"
# kurze Sichtprüfung, dass Frontend drin ist
jar tf "$JAR" | grep -E 'VAADIN|static/|index\.html' | head || true
- name: 📦 Nach /shared_jar_data deployen (fester Name + Archiv)
shell: bash
run: |
set -euxo pipefail
ts="$(date +'%Y%m%d-%H%M%S')"
mkdir -p /shared_jar_data /shared_jar_data/archive
SRC="$(ls -1 build/libs/*.jar | head -n1)"
# WICHTIG: Fester Name, den docker-compose startet
cp -f "$SRC" "/shared_jar_data/MyTimeTracker-0.0.1-SNAPSHOT.jar"
# Zusätzlich archivieren
cp -f "$SRC" "/shared_jar_data/archive/MyTimeTracker-${ts}.jar"
ls -al /shared_jar_data | tail -n +1
- name: 🔁 App neu starten (über Docker-CLI-Container)
shell: bash
run: |
set -euxo pipefail
docker run --rm -v /var/run/docker.sock:/var/run/docker.sock docker:27.1.1-cli \
restart mytimetracker-app