mirror of
https://github.com/docker/login-action.git
synced 2024-12-23 02:55:32 +00:00
Builtin exec
This commit is contained in:
parent
b7cd11b1fa
commit
da3da99964
11
dist/index.js
generated
vendored
11
dist/index.js
generated
vendored
|
@ -1074,8 +1074,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const os = __importStar(__webpack_require__(87));
|
||||
const core = __importStar(__webpack_require__(470));
|
||||
const exec = __importStar(__webpack_require__(986));
|
||||
const ecr = __importStar(__webpack_require__(34));
|
||||
const exec = __importStar(__webpack_require__(807));
|
||||
const execm = __importStar(__webpack_require__(807));
|
||||
const stateHelper = __importStar(__webpack_require__(153));
|
||||
function run() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
|
@ -1090,12 +1091,12 @@ function run() {
|
|||
const username = core.getInput('username');
|
||||
const password = core.getInput('password', { required: true });
|
||||
if (yield ecr.isECR(registry)) {
|
||||
yield exec.exec('aws', ['--version'], false);
|
||||
yield exec.exec('aws', ['--version']);
|
||||
const ecrRegion = yield ecr.getRegion(registry);
|
||||
process.env.AWS_ACCESS_KEY_ID = username;
|
||||
process.env.AWS_SECRET_ACCESS_KEY = password;
|
||||
core.info(`🔑 Logging into AWS ECR region ${ecrRegion}...`);
|
||||
yield exec.exec('aws', ['ecr', 'get-login', '--region', ecrRegion, '--no-include-email'], true).then(res => {
|
||||
yield execm.exec('aws', ['ecr', 'get-login', '--region', ecrRegion, '--no-include-email'], true).then(res => {
|
||||
if (res.stderr != '' && !res.success) {
|
||||
throw new Error(res.stderr);
|
||||
}
|
||||
|
@ -1114,7 +1115,7 @@ function run() {
|
|||
else {
|
||||
core.info(`🔑 Logging into DockerHub...`);
|
||||
}
|
||||
yield exec.exec('docker', loginArgs, true).then(res => {
|
||||
yield execm.exec('docker', loginArgs, true).then(res => {
|
||||
if (res.stderr != '' && !res.success) {
|
||||
throw new Error(res.stderr);
|
||||
}
|
||||
|
@ -1132,7 +1133,7 @@ function logout() {
|
|||
if (!stateHelper.logout) {
|
||||
return;
|
||||
}
|
||||
yield exec.exec('docker', ['logout', stateHelper.registry], false).then(res => {
|
||||
yield execm.exec('docker', ['logout', stateHelper.registry], false).then(res => {
|
||||
if (res.stderr != '' && !res.success) {
|
||||
core.warning(res.stderr);
|
||||
}
|
||||
|
|
12
src/main.ts
12
src/main.ts
|
@ -1,7 +1,9 @@
|
|||
import * as os from 'os';
|
||||
import * as core from '@actions/core';
|
||||
import * as exec from '@actions/exec';
|
||||
import * as ecr from './ecr';
|
||||
import * as exec from './exec';
|
||||
import * as execm from './exec';
|
||||
|
||||
import * as stateHelper from './state-helper';
|
||||
|
||||
async function run(): Promise<void> {
|
||||
|
@ -19,13 +21,13 @@ async function run(): Promise<void> {
|
|||
const password: string = core.getInput('password', {required: true});
|
||||
|
||||
if (await ecr.isECR(registry)) {
|
||||
await exec.exec('aws', ['--version'], false);
|
||||
await exec.exec('aws', ['--version']);
|
||||
const ecrRegion = await ecr.getRegion(registry);
|
||||
process.env.AWS_ACCESS_KEY_ID = username;
|
||||
process.env.AWS_SECRET_ACCESS_KEY = password;
|
||||
|
||||
core.info(`🔑 Logging into AWS ECR region ${ecrRegion}...`);
|
||||
await exec.exec('aws', ['ecr', 'get-login', '--region', ecrRegion, '--no-include-email'], true).then(res => {
|
||||
await execm.exec('aws', ['ecr', 'get-login', '--region', ecrRegion, '--no-include-email'], true).then(res => {
|
||||
if (res.stderr != '' && !res.success) {
|
||||
throw new Error(res.stderr);
|
||||
}
|
||||
|
@ -43,7 +45,7 @@ async function run(): Promise<void> {
|
|||
} else {
|
||||
core.info(`🔑 Logging into DockerHub...`);
|
||||
}
|
||||
await exec.exec('docker', loginArgs, true).then(res => {
|
||||
await execm.exec('docker', loginArgs, true).then(res => {
|
||||
if (res.stderr != '' && !res.success) {
|
||||
throw new Error(res.stderr);
|
||||
}
|
||||
|
@ -59,7 +61,7 @@ async function logout(): Promise<void> {
|
|||
if (!stateHelper.logout) {
|
||||
return;
|
||||
}
|
||||
await exec.exec('docker', ['logout', stateHelper.registry], false).then(res => {
|
||||
await execm.exec('docker', ['logout', stateHelper.registry], false).then(res => {
|
||||
if (res.stderr != '' && !res.success) {
|
||||
core.warning(res.stderr);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue