Files
mytimetracker/.gitea/workflows/buildAndDeply.yaml
nilzbu 39af511bbd
Some checks failed
Build-und-Deploy / build (push) Failing after 1m20s
pipeline
2025-08-09 16:33:33 +02:00

108 lines
3.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
steps:
# Node 20 + Git + Bash (für shell: bash) nötig für Node-Actions (checkout) & Vaadin
- name: 🧰 Node 20, Git & Bash installieren
run: |
apt-get update
apt-get install -y curl ca-certificates gnupg git bash
curl -fsSL https://deb.nodesource.com/setup_20.x | bash -
apt-get install -y nodejs
node -v && npm -v && git --version
# pnpm via Corepack (Vaadin nutzt Vite/pnpm)
corepack enable
corepack prepare pnpm@latest --activate
pnpm -v
- name: 📥 Repository auschecken
uses: actions/checkout@v4
- name: 🔎 Volumes & Umgebung prüfen
shell: bash
run: |
set -x
echo "PWD=$(pwd)"
java -version
which bash || true
ls -la
# Volumes sichtbar?
ls -ld /shared_jar_data || true
ls -ld /shared_trigger_dir || true
- name: 🧼 IP-Adresse von Gitea zu /etc/hosts hinzufügen
run: echo "172.26.0.2 gitea" >> /etc/hosts
# Gradle auf vorhandenes JDK 21 festnageln (kein Foojay-Download)
- name: ⚙️ Gradle konfigurieren
shell: bash
run: |
rm -rf ~/.gradle/jdks ~/.gradle/.tmp/jdks
mkdir -p ~/.gradle
{
echo "org.gradle.java.installations.auto-detect=true"
echo "org.gradle.java.installations.auto-download=false"
} > ~/.gradle/gradle.properties
# Diagnose: zeigt Java/Gradle-Setup im Job-Container
- name: 🔎 Umgebung prüfen
shell: bash
run: |
set -euo pipefail
echo "PWD=$(pwd)"
java -version
./gradlew -v
./gradlew -q javaToolchains || true
ls -la
- name: 🛠 Baue das Projekt (ohne Tests)
shell: bash
env:
CI: "true"
run: |
set -euo pipefail
test -f ./gradlew || { echo "❌ gradlew fehlt"; exit 1; }
chmod +x ./gradlew || true
./gradlew clean build -x test --no-daemon --info --stacktrace
echo "Build-Output (build/libs):"
ls -l build/libs || true
- name: 📦 JAR ins Shared Volume kopieren und archivieren
shell: bash
run: |
set -euo pipefail
# Falls der Name variiert, greifen wir den ersten SNAPSHOT-Jar
JAR="$(ls -1 build/libs/*-SNAPSHOT.jar 2>/dev/null | head -n1)"
if [[ -z "${JAR:-}" || ! -f "$JAR" ]]; then
echo "❌ Kein JAR in build/libs gefunden"; exit 1
fi
mkdir -p /shared_jar_data /shared_jar_data/archive
timestamp=$(date +"%Y%m%d-%H%M%S")
# Aktuelle Version bereitstellen
cp "$JAR" /shared_jar_data/MyTimeTracker-0.0.1-SNAPSHOT.jar
# Archivkopie
cp "$JAR" "/shared_jar_data/archive/MyTimeTracker-$timestamp.jar"
echo "📂 /shared_jar_data:"
ls -l /shared_jar_data || true
echo "📂 /shared_jar_data/archive:"
ls -l /shared_jar_data/archive || true
- name: 🚦 Neustart der Anwendung triggern
shell: bash
run: |
set -euo pipefail
mkdir -p /shared_trigger_dir
touch /shared_trigger_dir/restart-requested