assembled docker args
This commit is contained in:
parent
7d3526dec5
commit
8b24f0e395
48
dist/index.js
vendored
48
dist/index.js
vendored
@ -62129,9 +62129,7 @@ function addCiRegistryAuth(ci_registry, registryAuthJson) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (ci_registry === false || ci_registry.length <= 0) {
|
if (ci_registry === false || ci_registry.length <= 0) {
|
||||||
console.log(
|
console.log('WARNING: add_ci_registry_auth enabled but ci_registry is not set');
|
||||||
'WARNING: add_ci_registry_auth enabled but ci_registry is not set'
|
|
||||||
);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -62182,30 +62180,21 @@ function collectTags(information) {
|
|||||||
let tagCommitPrefix = (core.getInput('tag_commit_prefix') ?? '').trim();
|
let tagCommitPrefix = (core.getInput('tag_commit_prefix') ?? '').trim();
|
||||||
|
|
||||||
// handle semver
|
// handle semver
|
||||||
if (
|
if (core.getBooleanInput('tag_semver_major') && isNonEmptyStr(information.semver_major)) {
|
||||||
core.getBooleanInput('tag_semver_major') && isNonEmptyStr(information.semver_major)
|
|
||||||
) {
|
|
||||||
tags.push(tagPrefix + information.semver_major);
|
tags.push(tagPrefix + information.semver_major);
|
||||||
foundSemverTag = true;
|
foundSemverTag = true;
|
||||||
}
|
}
|
||||||
if (
|
if (core.getBooleanInput('tag_semver_minor') && isNonEmptyStr(information.semver_minor)) {
|
||||||
core.getBooleanInput('tag_semver_minor') && isNonEmptyStr(information.semver_minor)
|
|
||||||
) {
|
|
||||||
tags.push(tagPrefix + information.semver_minor);
|
tags.push(tagPrefix + information.semver_minor);
|
||||||
foundSemverTag = true;
|
foundSemverTag = true;
|
||||||
}
|
}
|
||||||
if (
|
if (core.getBooleanInput('tag_semver_patch') && isNonEmptyStr(information.semver_patch)) {
|
||||||
core.getBooleanInput('tag_semver_patch') && isNonEmptyStr(information.semver_patch)
|
|
||||||
) {
|
|
||||||
tags.push(tagPrefix + information.semver_patch);
|
tags.push(tagPrefix + information.semver_patch);
|
||||||
foundSemverTag = true;
|
foundSemverTag = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// handle git tag/branch
|
// handle git tag/branch
|
||||||
if (
|
if (core.getBooleanInput('tag_ref_normalized_enable') && foundSemverTag === false) {
|
||||||
core.getBooleanInput('tag_ref_normalized_enable') &&
|
|
||||||
foundSemverTag === false
|
|
||||||
) {
|
|
||||||
if (isNonEmptyStr(information.git_tag)) {
|
if (isNonEmptyStr(information.git_tag)) {
|
||||||
// TODO normalize tag from git for docker
|
// TODO normalize tag from git for docker
|
||||||
tags.push(tagPrefix + information.git_tag + tagSuffix);
|
tags.push(tagPrefix + information.git_tag + tagSuffix);
|
||||||
@ -62244,27 +62233,30 @@ function prepareDockerArgs(destinations) {
|
|||||||
dockerArgs = [];
|
dockerArgs = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
if(isNonEmptyStr(core.getInput("dockerfile"))) {
|
if (isNonEmptyStr(core.getInput('dockerfile'))) {
|
||||||
dockerArgs.unshift("--file " + core.getInput("dockerfile"))
|
dockerArgs.unshift('--file ' + core.getInput('dockerfile'));
|
||||||
}
|
}
|
||||||
|
|
||||||
if(isNonEmptyStr(core.getInput("docker_context_dir"))) {
|
if (isNonEmptyStr(core.getInput('docker_context_dir'))) {
|
||||||
dockerArgs.unshift(core.getInput("docker_context_dir"))
|
dockerArgs.unshift(core.getInput('docker_context_dir'));
|
||||||
} // TODO use runner workdir instead
|
}
|
||||||
|
else {
|
||||||
|
dockerArgs.unshift(process.env['GITHUB_WORKSPACE']);
|
||||||
|
}
|
||||||
|
|
||||||
if(core.getBooleanInput("squash_layers")) {
|
if (core.getBooleanInput('squash_layers')) {
|
||||||
dockerArgs.push("--squash")
|
dockerArgs.push('--squash');
|
||||||
}
|
}
|
||||||
|
|
||||||
destinations.forEach(dest => {
|
destinations.forEach(dest => {
|
||||||
dockerArgs.push("--tag " + dest)
|
dockerArgs.push('--tag ' + dest);
|
||||||
})
|
});
|
||||||
|
|
||||||
if(isNonEmptyStr(core.getInput("additional_registry_destinations"))) {
|
if (isNonEmptyStr(core.getInput('additional_registry_destinations'))) {
|
||||||
dockerArgs.push(core.getInput("additional_registry_destinations"))
|
dockerArgs.push(core.getInput('additional_registry_destinations'));
|
||||||
}
|
}
|
||||||
|
|
||||||
return dockerArgs
|
return dockerArgs;
|
||||||
}
|
}
|
||||||
|
|
||||||
;// CONCATENATED MODULE: ./src/action.js
|
;// CONCATENATED MODULE: ./src/action.js
|
||||||
|
|||||||
48
src/lib.js
48
src/lib.js
@ -29,9 +29,7 @@ export function addCiRegistryAuth(ci_registry, registryAuthJson) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (ci_registry === false || ci_registry.length <= 0) {
|
if (ci_registry === false || ci_registry.length <= 0) {
|
||||||
console.log(
|
console.log('WARNING: add_ci_registry_auth enabled but ci_registry is not set');
|
||||||
'WARNING: add_ci_registry_auth enabled but ci_registry is not set'
|
|
||||||
);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -82,30 +80,21 @@ export function collectTags(information) {
|
|||||||
let tagCommitPrefix = (core.getInput('tag_commit_prefix') ?? '').trim();
|
let tagCommitPrefix = (core.getInput('tag_commit_prefix') ?? '').trim();
|
||||||
|
|
||||||
// handle semver
|
// handle semver
|
||||||
if (
|
if (core.getBooleanInput('tag_semver_major') && isNonEmptyStr(information.semver_major)) {
|
||||||
core.getBooleanInput('tag_semver_major') && isNonEmptyStr(information.semver_major)
|
|
||||||
) {
|
|
||||||
tags.push(tagPrefix + information.semver_major);
|
tags.push(tagPrefix + information.semver_major);
|
||||||
foundSemverTag = true;
|
foundSemverTag = true;
|
||||||
}
|
}
|
||||||
if (
|
if (core.getBooleanInput('tag_semver_minor') && isNonEmptyStr(information.semver_minor)) {
|
||||||
core.getBooleanInput('tag_semver_minor') && isNonEmptyStr(information.semver_minor)
|
|
||||||
) {
|
|
||||||
tags.push(tagPrefix + information.semver_minor);
|
tags.push(tagPrefix + information.semver_minor);
|
||||||
foundSemverTag = true;
|
foundSemverTag = true;
|
||||||
}
|
}
|
||||||
if (
|
if (core.getBooleanInput('tag_semver_patch') && isNonEmptyStr(information.semver_patch)) {
|
||||||
core.getBooleanInput('tag_semver_patch') && isNonEmptyStr(information.semver_patch)
|
|
||||||
) {
|
|
||||||
tags.push(tagPrefix + information.semver_patch);
|
tags.push(tagPrefix + information.semver_patch);
|
||||||
foundSemverTag = true;
|
foundSemverTag = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// handle git tag/branch
|
// handle git tag/branch
|
||||||
if (
|
if (core.getBooleanInput('tag_ref_normalized_enable') && foundSemverTag === false) {
|
||||||
core.getBooleanInput('tag_ref_normalized_enable') &&
|
|
||||||
foundSemverTag === false
|
|
||||||
) {
|
|
||||||
if (isNonEmptyStr(information.git_tag)) {
|
if (isNonEmptyStr(information.git_tag)) {
|
||||||
// TODO normalize tag from git for docker
|
// TODO normalize tag from git for docker
|
||||||
tags.push(tagPrefix + information.git_tag + tagSuffix);
|
tags.push(tagPrefix + information.git_tag + tagSuffix);
|
||||||
@ -144,25 +133,28 @@ export function prepareDockerArgs(destinations) {
|
|||||||
dockerArgs = [];
|
dockerArgs = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
if(isNonEmptyStr(core.getInput("dockerfile"))) {
|
if (isNonEmptyStr(core.getInput('dockerfile'))) {
|
||||||
dockerArgs.unshift("--file " + core.getInput("dockerfile"))
|
dockerArgs.unshift('--file ' + core.getInput('dockerfile'));
|
||||||
}
|
}
|
||||||
|
|
||||||
if(isNonEmptyStr(core.getInput("docker_context_dir"))) {
|
if (isNonEmptyStr(core.getInput('docker_context_dir'))) {
|
||||||
dockerArgs.unshift(core.getInput("docker_context_dir"))
|
dockerArgs.unshift(core.getInput('docker_context_dir'));
|
||||||
} // TODO use runner workdir instead
|
}
|
||||||
|
else {
|
||||||
|
dockerArgs.unshift(process.env['GITHUB_WORKSPACE']);
|
||||||
|
}
|
||||||
|
|
||||||
if(core.getBooleanInput("squash_layers")) {
|
if (core.getBooleanInput('squash_layers')) {
|
||||||
dockerArgs.push("--squash")
|
dockerArgs.push('--squash');
|
||||||
}
|
}
|
||||||
|
|
||||||
destinations.forEach(dest => {
|
destinations.forEach(dest => {
|
||||||
dockerArgs.push("--tag " + dest)
|
dockerArgs.push('--tag ' + dest);
|
||||||
})
|
});
|
||||||
|
|
||||||
if(isNonEmptyStr(core.getInput("additional_registry_destinations"))) {
|
if (isNonEmptyStr(core.getInput('additional_registry_destinations'))) {
|
||||||
dockerArgs.push(core.getInput("additional_registry_destinations"))
|
dockerArgs.push(core.getInput('additional_registry_destinations'));
|
||||||
}
|
}
|
||||||
|
|
||||||
return dockerArgs
|
return dockerArgs;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user