compose: cloud releases support

Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
This commit is contained in:
CrazyMax
2025-01-20 15:38:48 +01:00
parent 2925ff2bef
commit 1229986252
3 changed files with 59 additions and 10 deletions

View File

@@ -63,7 +63,7 @@ export class Install {
}
const installCache = new Cache({
htcName: 'compose-dl-bin',
htcName: version.key != 'official' ? `compose-dl-bin-${version.key}` : 'compose-dl-bin',
htcVersion: vspec,
baseCacheDir: path.join(os.homedir(), '.bin'),
cacheFile: os.platform() == 'win32' ? 'docker-compose.exe' : 'docker-compose',
@@ -172,11 +172,32 @@ export class Install {
}
public static async getDownloadVersion(v: string): Promise<DownloadVersion> {
return {
version: v,
downloadURL: 'https://github.com/docker/compose/releases/download/v%s/%s',
releasesURL: 'https://raw.githubusercontent.com/docker/actions-toolkit/main/.github/compose-releases.json'
};
let [repoKey, version] = v.split(':');
if (!version) {
version = repoKey;
repoKey = 'official';
}
switch (repoKey) {
case 'official': {
return {
key: repoKey,
version: version,
downloadURL: 'https://github.com/docker/compose/releases/download/v%s/%s',
releasesURL: 'https://raw.githubusercontent.com/docker/actions-toolkit/main/.github/compose-releases.json'
};
}
case 'cloud': {
return {
key: repoKey,
version: version,
downloadURL: 'https://github.com/docker/compose-desktop/releases/download/v%s/%s',
releasesURL: 'https://raw.githubusercontent.com/docker/actions-toolkit/main/.github/compose-lab-releases.json'
};
}
default: {
throw new Error(`Cannot find compose version for ${v}`);
}
}
}
public static async getRelease(version: DownloadVersion): Promise<GitHubRelease> {

View File

@@ -15,6 +15,7 @@
*/
export interface DownloadVersion {
key: string;
version: string;
downloadURL: string;
releasesURL: string;