chore: sync versions
All checks were successful
Monorepo Pipeline / 🧪 Quality Assurance (push) Successful in 2m6s
Monorepo Pipeline / 🚀 Release (push) Has been skipped
Monorepo Pipeline / 🐳 Build Directus (Base) (push) Has been skipped
Monorepo Pipeline / 🐳 Build Gatekeeper (Product) (push) Has been skipped
Monorepo Pipeline / 🐳 Build Build-Base (push) Has been skipped
Monorepo Pipeline / 🐳 Build Production Runtime (push) Has been skipped

This commit is contained in:
2026-02-10 00:39:34 +01:00
parent 367c4d8404
commit f2c0a4581c
21 changed files with 76 additions and 36 deletions

View File

@@ -4,9 +4,15 @@ import * as path from "path";
import { execSync } from "child_process";
/**
* Gets the current version tag from environment or git.
* Gets the current version tag from arguments, environment or git.
*/
function getVersionTag() {
// 0. Check arguments (passed from husky hook or manual run)
const argTag = process.argv.slice(2).find((arg) => arg.startsWith("v"));
if (argTag) {
return argTag;
}
// 1. Check CI environment variables
if (
process.env.GITHUB_REF_NAME &&
@@ -67,20 +73,50 @@ function updatePkg(pkgPath: string) {
console.log(`✅ Updated ${pkg.name} to ${version}`);
}
/**
* Updates the IMAGE_TAG in .env files.
*/
function updateEnv(envPath: string) {
if (!fs.existsSync(envPath)) return;
let content = fs.readFileSync(envPath, "utf-8");
if (content.includes("IMAGE_TAG=")) {
content = content.replace(/IMAGE_TAG=.*/g, `IMAGE_TAG=${tag}`);
} else {
// Proactively add it if missing
if (content.includes("# Project")) {
content = content.replace("# Project", `# Project\nIMAGE_TAG=${tag}`);
} else {
content = `IMAGE_TAG=${tag}\n${content}`;
}
}
fs.writeFileSync(envPath, content);
console.log(`✅ Updated IMAGE_TAG in ${envPath} to ${tag}`);
}
// Update root
rootPkg.version = version;
fs.writeFileSync("package.json", JSON.stringify(rootPkg, null, 2) + "\n");
// Update all packages
const packages = fs.readdirSync(packagesDir);
for (const p of packages) {
updatePkg(path.join(packagesDir, p, "package.json"));
if (fs.existsSync(packagesDir)) {
const packages = fs.readdirSync(packagesDir);
for (const p of packages) {
updatePkg(path.join(packagesDir, p, "package.json"));
}
}
// Update all apps
const apps = fs.readdirSync(appsDir);
for (const a of apps) {
updatePkg(path.join(appsDir, a, "package.json"));
if (fs.existsSync(appsDir)) {
const apps = fs.readdirSync(appsDir);
for (const a of apps) {
updatePkg(path.join(appsDir, a, "package.json"));
}
}
// Update .env files
updateEnv(".env");
updateEnv(".env.example");
console.log("✨ All versions synced!");