Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
This commit is contained in:
CrazyMax 2025-09-05 18:26:35 +02:00
parent b614728cdc
commit 8474404dec
No known key found for this signature in database
GPG Key ID: ADE44D8C9D44FBE4
4 changed files with 8 additions and 11 deletions

2
dist/index.js generated vendored

File diff suppressed because one or more lines are too long

2
dist/index.js.map generated vendored

File diff suppressed because one or more lines are too long

View File

@ -36,11 +36,7 @@ export async function loginStandard(registry: string, username: string, password
loginArgs.push('--username', username);
loginArgs.push(registry);
if (registry) {
core.info(`Logging into ${registry}...`);
} else {
core.info(`Logging into Docker Hub...`);
}
core.info(`Logging into ${registry}...`);
await Docker.getExecOutput(loginArgs, {
ignoreReturnCode: true,
silent: true,

View File

@ -7,10 +7,10 @@ import * as docker from './docker';
import * as stateHelper from './state-helper';
interface Auth {
registry: string;
registry?: string;
username: string;
password: string;
ecr: string;
ecr?: string;
}
export async function main(): Promise<void> {
@ -28,6 +28,7 @@ export async function main(): Promise<void> {
}
const add = yaml.load(inputs.add) as Auth[];
core.info(`add: ${JSON.stringify(add, null, 2)}`);
if (Array.isArray(add)) {
auths.push(...add);
}
@ -46,11 +47,11 @@ export async function main(): Promise<void> {
throw new Error('No registry to login');
}
if (auths.length === 1) {
await docker.login(auths[0].registry, auths[0].username, auths[0].password, auths[0].ecr || 'auto');
await docker.login(auths[0].registry || 'docker.io', auths[0].username, auths[0].password, auths[0].ecr || 'auto');
} else {
for (const auth of auths) {
await core.group(`Login to ${auth.registry || 'docker.io'}`, async () => {
await docker.login(auth.registry, auth.username, auth.password, auth.ecr || 'auto');
await docker.login(auth.registry || 'docker.io', auth.username, auth.password, auth.ecr || 'auto');
});
}
}