ci: fix generate version plugin hiding previous errors (@fehmer) (#7060)

When build fails for some reason the generate version step also failed
because the `/dist` directory is missing. This was hiding other problems
like an error in the fontawesome step.

Also changes the trigger for the frontend build to include `html` files.
This commit is contained in:
Christian Fehmer 2025-10-29 11:56:49 +01:00 committed by GitHub
parent 78b0eb25ab
commit b5755faa30
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 17 additions and 4 deletions

View file

@ -49,7 +49,7 @@ jobs:
- 'backend/**/*.{ts,js,json,lua,css,html}'
- 'backend/package.json'
fe-src:
- 'frontend/**/*.{ts,scss}'
- 'frontend/**/*.{ts,scss,html}'
- 'frontend/package.json'
pkg-src:
- 'packages/**/*'

View file

@ -99,7 +99,9 @@ export function getFontawesomeConfig(debug = false): FontawesomeConfig {
(it) => !(solid.includes(it) || regular.includes(it) || brands.includes(it))
);
if (leftOvers.length !== 0) {
throw new Error("unknown icons: " + leftOvers.toString());
throw new Error(
"Fontawesome failed with unknown icons: " + leftOvers.toString()
);
}
if (debug) {

View file

@ -9,7 +9,13 @@ import { checker } from "vite-plugin-checker";
import { writeFileSync } from "fs";
// eslint-disable-next-line import/no-unresolved
import UnpluginInjectPreload from "unplugin-inject-preload/vite";
import { readdirSync, readFileSync, statSync } from "node:fs";
import {
existsSync,
mkdirSync,
readdirSync,
readFileSync,
statSync,
} from "node:fs";
import { ViteMinifyPlugin } from "vite-plugin-minify";
import { sentryVitePlugin } from "@sentry/vite-plugin";
import { getFontsConig } from "./vite.config";
@ -68,9 +74,14 @@ export default {
apply: "build",
closeBundle() {
const distPath = path.resolve(__dirname, "dist");
if (!existsSync(distPath)) {
mkdirSync(distPath, { recursive: true });
}
const version = CLIENT_VERSION;
const versionJson = JSON.stringify({ version });
const versionPath = path.resolve(__dirname, "dist/version.json");
const versionPath = path.resolve(distPath, "version.json");
writeFileSync(versionPath, versionJson);
},
},