mirror of
https://github.com/docker/setup-buildx-action.git
synced 2024-11-27 08:19:03 +00:00
Merge pull request #17 from crazy-max/more-platform-support
Add support for more platforms
This commit is contained in:
commit
80d96c0f60
36
dist/index.js
generated
vendored
36
dist/index.js
generated
vendored
@ -2039,12 +2039,8 @@ function install(inputVersion, dockerConfigHome) {
|
|||||||
exports.install = install;
|
exports.install = install;
|
||||||
function download(version) {
|
function download(version) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
version = semver.clean(version) || '';
|
|
||||||
const platform = context.osPlat == 'win32' ? 'windows' : context.osPlat;
|
|
||||||
const ext = context.osPlat == 'win32' ? '.exe' : '';
|
|
||||||
const filename = util.format('buildx-v%s.%s-amd64%s', version, platform, ext);
|
|
||||||
const targetFile = context.osPlat == 'win32' ? 'docker-buildx.exe' : 'docker-buildx';
|
const targetFile = context.osPlat == 'win32' ? 'docker-buildx.exe' : 'docker-buildx';
|
||||||
const downloadUrl = util.format('https://github.com/docker/buildx/releases/download/v%s/%s', version, filename);
|
const downloadUrl = util.format('https://github.com/docker/buildx/releases/download/v%s/%s', version, yield filename(version));
|
||||||
let downloadPath;
|
let downloadPath;
|
||||||
try {
|
try {
|
||||||
core.info(`⬇️ Downloading ${downloadUrl}...`);
|
core.info(`⬇️ Downloading ${downloadUrl}...`);
|
||||||
@ -2057,6 +2053,33 @@ function download(version) {
|
|||||||
return yield tc.cacheFile(downloadPath, targetFile, 'buildx', version);
|
return yield tc.cacheFile(downloadPath, targetFile, 'buildx', version);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
function filename(version) {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
let arch;
|
||||||
|
switch (context.osArch) {
|
||||||
|
case 'x64': {
|
||||||
|
arch = 'amd64';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 'ppc64': {
|
||||||
|
arch = 'ppc64le';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 'arm': {
|
||||||
|
const arm_version = process.config.variables.arm_version;
|
||||||
|
arch = arm_version ? 'arm-v' + arm_version : 'arm';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default: {
|
||||||
|
arch = context.osArch;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const platform = context.osPlat == 'win32' ? 'windows' : context.osPlat;
|
||||||
|
const ext = context.osPlat == 'win32' ? '.exe' : '';
|
||||||
|
return util.format('buildx-v%s.%s-%s%s', version, platform, arch, ext);
|
||||||
|
});
|
||||||
|
}
|
||||||
//# sourceMappingURL=buildx.js.map
|
//# sourceMappingURL=buildx.js.map
|
||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
@ -6540,10 +6563,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
exports.asyncForEach = exports.getInputList = exports.getInputs = exports.osPlat = void 0;
|
exports.asyncForEach = exports.getInputList = exports.getInputs = exports.osArch = exports.osPlat = void 0;
|
||||||
const os = __importStar(__webpack_require__(87));
|
const os = __importStar(__webpack_require__(87));
|
||||||
const core = __importStar(__webpack_require__(186));
|
const core = __importStar(__webpack_require__(186));
|
||||||
exports.osPlat = os.platform();
|
exports.osPlat = os.platform();
|
||||||
|
exports.osArch = os.arch();
|
||||||
function getInputs() {
|
function getInputs() {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
return {
|
return {
|
||||||
|
@ -92,13 +92,12 @@ export async function install(inputVersion: string, dockerConfigHome: string): P
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function download(version: string): Promise<string> {
|
async function download(version: string): Promise<string> {
|
||||||
version = semver.clean(version) || '';
|
|
||||||
const platform: string = context.osPlat == 'win32' ? 'windows' : context.osPlat;
|
|
||||||
const ext: string = context.osPlat == 'win32' ? '.exe' : '';
|
|
||||||
const filename: string = util.format('buildx-v%s.%s-amd64%s', version, platform, ext);
|
|
||||||
const targetFile: string = context.osPlat == 'win32' ? 'docker-buildx.exe' : 'docker-buildx';
|
const targetFile: string = context.osPlat == 'win32' ? 'docker-buildx.exe' : 'docker-buildx';
|
||||||
|
const downloadUrl = util.format(
|
||||||
const downloadUrl = util.format('https://github.com/docker/buildx/releases/download/v%s/%s', version, filename);
|
'https://github.com/docker/buildx/releases/download/v%s/%s',
|
||||||
|
version,
|
||||||
|
await filename(version)
|
||||||
|
);
|
||||||
let downloadPath: string;
|
let downloadPath: string;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -111,3 +110,29 @@ async function download(version: string): Promise<string> {
|
|||||||
|
|
||||||
return await tc.cacheFile(downloadPath, targetFile, 'buildx', version);
|
return await tc.cacheFile(downloadPath, targetFile, 'buildx', version);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function filename(version: string): Promise<string> {
|
||||||
|
let arch: string;
|
||||||
|
switch (context.osArch) {
|
||||||
|
case 'x64': {
|
||||||
|
arch = 'amd64';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 'ppc64': {
|
||||||
|
arch = 'ppc64le';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 'arm': {
|
||||||
|
const arm_version = (process.config.variables as any).arm_version;
|
||||||
|
arch = arm_version ? 'arm-v' + arm_version : 'arm';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default: {
|
||||||
|
arch = context.osArch;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const platform: string = context.osPlat == 'win32' ? 'windows' : context.osPlat;
|
||||||
|
const ext: string = context.osPlat == 'win32' ? '.exe' : '';
|
||||||
|
return util.format('buildx-v%s.%s-%s%s', version, platform, arch, ext);
|
||||||
|
}
|
||||||
|
@ -2,6 +2,7 @@ import * as os from 'os';
|
|||||||
import * as core from '@actions/core';
|
import * as core from '@actions/core';
|
||||||
|
|
||||||
export const osPlat: string = os.platform();
|
export const osPlat: string = os.platform();
|
||||||
|
export const osArch: string = os.arch();
|
||||||
|
|
||||||
export interface Inputs {
|
export interface Inputs {
|
||||||
version: string;
|
version: string;
|
||||||
|
Loading…
Reference in New Issue
Block a user