This commit is contained in:
David Hiendl 2023-12-02 19:57:18 +01:00
parent 82ec3f239f
commit d4b182543e
3 changed files with 74 additions and 52 deletions

22
dist/index.js vendored
View File

@ -62095,12 +62095,15 @@ const gBase64 = {
// and finally,
// EXTERNAL MODULE: external "path"
var external_path_ = __nccwpck_require__(1017);
;// CONCATENATED MODULE: ./src/lib.js
function processAdditionalRegistries(targetRegistries) {
const additionalRegistries = core.getInput('additional_registries');
if (additionalRegistries != null && additionalRegistries.length > 0) {
@ -62154,7 +62157,7 @@ function mergeArgRegistryAuthJson(registryAuthJson) {
}
}
}
catch (e) {
catch (error) {
console.log('Failed to parse registry auth json', e);
core.setFailed(error.message);
process.exit(1);
@ -62162,8 +62165,9 @@ function mergeArgRegistryAuthJson(registryAuthJson) {
}
}
function writeRegistryAuthJson(registryAuthJson, path) {
external_fs_.writeFileSync(path, JSON.stringify(registryAuthJson, null, 2));
function writeRegistryAuthJson(registryAuthJson, targetFile) {
external_fs_.mkdirSync(external_path_.dirname(targetFile), {recursive: true});
external_fs_.writeFileSync(targetFile, JSON.stringify(registryAuthJson, null, 2));
}
function collectTags() {
@ -62236,7 +62240,9 @@ function prepareDestinations(registries, tags) {
const action_information = collect_all(true, false);
try {
const information = collect_all(true, false);
const debug = !!core.getInput('debug');
let targetRegistries = [];
@ -62244,7 +62250,7 @@ const repoStr = github.context.repo.owner + '/' + github.context.repo.rep
let ci_registry = false;
if (core.getBooleanInput('add_ci_registry_target')) {
ci_registry = action_information.ci_hostname + '/' + repoStr;
ci_registry = information.ci_hostname + '/' + repoStr;
targetRegistries.push(ci_registry);
}
@ -62263,6 +62269,12 @@ const destinations = prepareDestinations(targetRegistries, tags);
if (debug) {
console.log('destinations:', JSON.stringify(tags, null, 2));
}
}
catch (error) {
console.log('Failed to build docker image', e);
core.setFailed(error.message);
process.exit(1);
}
})();

View File

@ -10,6 +10,8 @@ import {
writeRegistryAuthJson
} from './lib';
try {
const information = action_information.collect_all(true, false);
const debug = !!core.getInput('debug');
@ -37,3 +39,9 @@ const destinations = prepareDestinations(targetRegistries, tags);
if (debug) {
console.log('destinations:', JSON.stringify(tags, null, 2));
}
}
catch (error) {
console.log('Failed to build docker image', e);
core.setFailed(error.message);
process.exit(1);
}

View File

@ -2,6 +2,7 @@ import * as core from '@actions/core';
import * as github from '@actions/github';
import * as fs from 'fs';
import {Base64} from 'js-base64';
import * as path from 'path';
export function processAdditionalRegistries(targetRegistries) {
const additionalRegistries = core.getInput('additional_registries');
@ -56,7 +57,7 @@ export function mergeArgRegistryAuthJson(registryAuthJson) {
}
}
}
catch (e) {
catch (error) {
console.log('Failed to parse registry auth json', e);
core.setFailed(error.message);
process.exit(1);
@ -64,8 +65,9 @@ export function mergeArgRegistryAuthJson(registryAuthJson) {
}
}
export function writeRegistryAuthJson(registryAuthJson, path) {
fs.writeFileSync(path, JSON.stringify(registryAuthJson, null, 2));
export function writeRegistryAuthJson(registryAuthJson, targetFile) {
fs.mkdirSync(path.dirname(targetFile), {recursive: true});
fs.writeFileSync(targetFile, JSON.stringify(registryAuthJson, null, 2));
}
export function collectTags() {