2
0
Fork 0
mirror of https://code.forgejo.org/docker/build-push-action.git synced 2025-08-17 17:20:53 +00:00

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:29:36 +02:00
parent 128f05c85a
commit 94827201d1
No known key found for this signature in database
GPG key ID: 3248E46B6BB8C7F7
7 changed files with 39 additions and 38 deletions

View file

@ -107,10 +107,14 @@ 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];
}
export function satisfies(version: string, range: string): boolean {
return semver.satisfies(version, range) || /^[0-9a-f]{7}$/.exec(version) !== null;
}