refactor(updateScript): make commit msg cleaner
All checks were successful
Discord / discord commits (push) Has been skipped

This commit is contained in:
matt1432 2024-11-04 16:00:32 -05:00
parent c11fe8867c
commit 09be304b8e

View file

@ -23,6 +23,8 @@ export const updateFlakeInputs = () => {
'flake-parts', 'flake-parts',
'treefmt-nix', 'treefmt-nix',
'lib-aggregate', 'lib-aggregate',
'lib-aggregate/nixpkgs-lib',
'sops-nix/nixpkgs-stable',
].some((inputName) => input.startsWith(` Updated input '${inputName}'`))) ].some((inputName) => input.startsWith(` Updated input '${inputName}'`)))
.join('\n\n•') .join('\n\n•')
// Shorten git revs to help readability // Shorten git revs to help readability
@ -36,27 +38,26 @@ export const updateFlakeInputs = () => {
}; };
export const updateDocker = () => { export const updateDocker = () => {
const updateImages = (imagePath: string): string | undefined => {
console.log(`Updating ${imagePath.split('/').at(-1)} images`);
const out = spawnSync('updateImages', [imagePath], { shell: true }).stdout.toString();
if (out !== '# Locked') {
return out;
}
};
let updates = ''; let updates = '';
console.log('Updating jfa-go image'); updates += updateImages(`${FLAKE}/devices/nos/modules/jellyfin`) ?? '';
updates += spawnSync('updateImages', updates += updateImages(`${FLAKE}/devices/homie/modules/home-assistant/netdaemon`) ?? '';
[`${FLAKE}/devices/nos/modules/jellyfin`],
{ shell: true })
.stdout.toString();
console.log('Updating netdaemon image'); const DIR = `${FLAKE}/devices/nos/modules/docker`;
updates += spawnSync('updateImages',
[`${FLAKE}/devices/homie/modules/home-assistant/netdaemon`],
{ shell: true })
.stdout.toString();
const FILE = `${FLAKE}/devices/nos/modules/docker`; readdirSync(DIR, { withFileTypes: true, recursive: true }).forEach((path) => {
readdirSync(FILE, { withFileTypes: true, recursive: true }).forEach((path) => {
if (path.name === 'compose.nix') { if (path.name === 'compose.nix') {
console.log(`Updating ${path.parentPath.split('/').at(-1)} images`); updates += updateImages(path.parentPath) ?? '';
updates += spawnSync('updateImages', [path.parentPath], { shell: true })
.stdout.toString();
} }
}); });