mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-01-10 09:51:02 +01:00
@@ -52,7 +52,9 @@ async function run(opts: { patch: boolean })
|
|||||||
|
|
||||||
const versionRegex = config.maintenance.version_regex ? new RegExp(config.maintenance.version_regex) : null;
|
const versionRegex = config.maintenance.version_regex ? new RegExp(config.maintenance.version_regex) : null;
|
||||||
|
|
||||||
const dockerFilePath = path.join(root, addon, "Dockerfile");
|
const addonPath = path.join(root, addon);
|
||||||
|
const changelogPath = path.join(addonPath, "CHANGELOG.md");
|
||||||
|
const dockerFilePath = path.join(addonPath, "Dockerfile");
|
||||||
const dockerFile = (await fs.readFileAsync(dockerFilePath)).toString();
|
const dockerFile = (await fs.readFileAsync(dockerFilePath)).toString();
|
||||||
const dockerBaseImageLine = dockerFile.split("\n")[0];
|
const dockerBaseImageLine = dockerFile.split("\n")[0];
|
||||||
const parts = dockerBaseImageLine.split(":");
|
const parts = dockerBaseImageLine.split(":");
|
||||||
@@ -109,10 +111,28 @@ async function run(opts: { patch: boolean })
|
|||||||
console.log(chalk.yellow(`bumping version from ${chalk.cyanBright(version)} to ${chalk.cyanBright(newVersion)}`));
|
console.log(chalk.yellow(`bumping version from ${chalk.cyanBright(version)} to ${chalk.cyanBright(newVersion)}`));
|
||||||
config.version = newVersion;
|
config.version = newVersion;
|
||||||
await fs.writeJSONAsync(configPath, config);
|
await fs.writeJSONAsync(configPath, config);
|
||||||
|
|
||||||
|
let oldChangelog = "";
|
||||||
|
if (await fs.existsAsync(changelogPath))
|
||||||
|
{
|
||||||
|
oldChangelog = (await fs.readFileAsync(changelogPath)).toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
let changelog = `## ${newVersion}\n\n - ${minorUpgrade ?
|
||||||
|
`Update ${config.name} to ${newAppVersion} (${image}:${releaseInfo.tag_name})` :
|
||||||
|
`Update base image to ${image}:${releaseInfo.tag_name}`}`;
|
||||||
|
|
||||||
|
if (oldChangelog)
|
||||||
|
{
|
||||||
|
changelog += `\n\n${oldChangelog}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
await fs.writeFileAsync(changelogPath, changelog);
|
||||||
|
|
||||||
updated = true;
|
updated = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
run(argv);
|
run(argv);
|
||||||
Reference in New Issue
Block a user