Handle git sha version of buildx

Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
This commit is contained in:
CrazyMax
2021-07-01 15:48:09 +02:00
parent 74b5bf4701
commit c77e0eff0f
6 changed files with 20 additions and 3085 deletions

View File

@@ -29,10 +29,10 @@ export async function getVersion(): Promise<string> {
});
}
export async function parseVersion(stdout: string): Promise<string> {
const matches = /\sv?([0-9.]+)/.exec(stdout);
export function parseVersion(stdout: string): string {
const matches = /\sv?([0-9a-f]{7}|[0-9.]+)/.exec(stdout);
if (!matches) {
throw new Error(`Cannot parse buildx version`);
}
return semver.clean(matches[1]);
return matches[1];
}