CI-Fix: Anleitungs-Stand liest Hash aus GITHUB_SHA wenn kein .git verfügbar
Build & Deploy / deploy (push) Successful in 25s
Build & Deploy / deploy (push) Successful in 25s
This commit is contained in:
@@ -1,10 +1,17 @@
|
||||
// Aktualisiert den Build-Stand der Anleitungsseite.
|
||||
// Wird bei jedem Deploy (deploy.sh, Schritt 1) VOR dem Frontend-Build aufgerufen,
|
||||
// Wird bei jedem Deploy (deploy.sh / CI-Pipeline) VOR dem Frontend-Build aufgerufen,
|
||||
// damit Anleitung und ausgelieferte Version garantiert zusammenpassen.
|
||||
// Hash-Quelle: git (lokal/Deploy-Skript) oder GITHUB_SHA (Gitea Actions, kein .git im Job-Container).
|
||||
import { execSync } from 'node:child_process'
|
||||
import { writeFileSync } from 'node:fs'
|
||||
|
||||
const hash = execSync('git rev-parse --short HEAD').toString().trim()
|
||||
let hash = ''
|
||||
try {
|
||||
hash = execSync('git rev-parse --short HEAD').toString().trim()
|
||||
} catch {
|
||||
hash = (process.env.GITHUB_SHA || '').slice(0, 7)
|
||||
}
|
||||
if (!hash) hash = 'dev'
|
||||
const datum = new Date().toLocaleString('de-DE', {
|
||||
day: '2-digit', month: '2-digit', year: 'numeric',
|
||||
hour: '2-digit', minute: '2-digit',
|
||||
|
||||
Reference in New Issue
Block a user