refactor(builds): refactored the build process to hold in the build info plus version
All checks were successful
Build and Push LST Docker Image / docker (push) Successful in 3m54s
All checks were successful
Build and Push LST Docker Image / docker (push) Successful in 3m54s
This commit is contained in:
@@ -2,6 +2,7 @@ import { spawn } from "node:child_process";
|
||||
import { createLogger } from "../logger/logger.controller.js";
|
||||
import { emitToRoom } from "../socket.io/roomEmitter.socket.js";
|
||||
import { updateAppStats } from "./updateAppStats.utils.js";
|
||||
import { getAppVersion } from "./version.utils.js";
|
||||
import { zipBuild } from "./zipper.utils.js";
|
||||
|
||||
export const emitBuildLog = (message: string, level = "info") => {
|
||||
@@ -28,6 +29,8 @@ export let building = false;
|
||||
const log = createLogger({ module: "utils", subModule: "builds" });
|
||||
export const build = async () => {
|
||||
const appDir = process.env.DEV_DIR ?? "";
|
||||
const build = await getAppVersion();
|
||||
|
||||
return new Promise((resolve) => {
|
||||
building = true;
|
||||
|
||||
@@ -72,6 +75,7 @@ export const build = async () => {
|
||||
updateAppStats({
|
||||
lastUpdated: new Date(),
|
||||
building: false,
|
||||
currentBuild: build.build,
|
||||
});
|
||||
emitBuildLog(`Build failed with code ${code}`, "error");
|
||||
//reject(new Error(`Build failed with code ${code}`));
|
||||
|
||||
@@ -4,6 +4,7 @@ import { appStats } from "../db/schema/stats.schema.js";
|
||||
export const updateAppStats = async (
|
||||
data: Partial<typeof appStats.$inferInsert>,
|
||||
) => {
|
||||
console.log(data);
|
||||
await db
|
||||
.insert(appStats)
|
||||
.values({
|
||||
|
||||
@@ -11,6 +11,7 @@ export const getAppVersion = async () => {
|
||||
|
||||
return {
|
||||
version: `${config.version}.${parseInt((config.build as string) ?? "1", 0) - 1}`,
|
||||
build: parseInt((config.build as string) ?? "1", 0),
|
||||
lastBuildTime: config.lastBuildDate,
|
||||
};
|
||||
};
|
||||
|
||||
@@ -168,6 +168,7 @@ export const zipBuild = async () => {
|
||||
await updateAppStats({
|
||||
lastUpdated: new Date(),
|
||||
building: false,
|
||||
currentBuild: lstVersion.build,
|
||||
});
|
||||
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user