mirror of
https://github.com/rajnandan1/kener.git
synced 2026-01-01 15:10:44 -06:00
Changed from trying to use artifacts and the GHA workflow failing to now using a simple `BUILD_VERSION` repository variable and automatically updating that when the `build-and-push-to-registries` workflow succeeds. Other changes include: * Added `workflow_run` trigger to `generate-readme.yml` so when that workflow recognizes the “Publish Docker Image to Registries” workflow runs and succeeds, it will automatically run the `generate-readme.yml` workflow (since a new Docker release will require Docker image variants table in README.md to have versioning updated) * Generate major and major-minor versions from the `BUILD_VERSION` repository variable (more efficient than storing three separate variables from the `build-and-push-to-registries` workflow job)
32 lines
990 B
JavaScript
32 lines
990 B
JavaScript
import fs from "fs";
|
|
import Mustache from "mustache";
|
|
import dotenv from "dotenv";
|
|
import { fileURLToPath } from "url";
|
|
import path from "path";
|
|
|
|
// Load environment variables from .env file
|
|
dotenv.config();
|
|
|
|
// Resolve paths correctly in ES modules
|
|
const __filename = fileURLToPath(import.meta.url);
|
|
const __dirname = path.dirname(__filename);
|
|
|
|
// Load the template
|
|
const templatePath = path.resolve(__dirname, "../README.template.md");
|
|
const template = fs.readFileSync(templatePath, "utf-8");
|
|
|
|
// Load environment variables and provide default values
|
|
const data = {
|
|
kener_full_version: process.env.BUILD_FULL_VERSION || "N/A",
|
|
kener_major_version: process.env.BUILD_MAJOR_VERSION || "N/A",
|
|
kener_major_minor_version: process.env.BUILD_MAJOR_MINOR_VERSION || "N/A",
|
|
};
|
|
|
|
// Render README.md
|
|
const output = Mustache.render(template, data);
|
|
|
|
// Write to README.md
|
|
fs.writeFileSync(path.resolve(__dirname, "../README.md"), output);
|
|
|
|
console.log("✅ README.md generated successfully!");
|