forked from actions/hello-world-javascript-action
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
51 lines (43 loc) · 1.09 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
const util = require('util');
const exec = util.promisify(require('child_process').exec);
const path = require('path');
const run = async () => {
// Logs
const process_cwd = path.resolve(process.env['RUNNER_TEMP'] || process.cwd());
const npmrcPath = path.resolve(process_cwd, '.npmrc');
const nowPath = path.resolve(__dirname);
console.log(`process_cwd: ${process_cwd}`);
{
const {stdout, stderr} = await exec('ls -l', {
cwd: process_cwd
});
console.log(stdout);
if (stderr) {
return Promise.reject(stderr);
}
}
console.log(`.npmrc: ${npmrcPath}`);
console.log(`nowPath: ${nowPath}`);
{
const {stdout, stderr} = await exec('ls -l', {
cwd: nowPath
});
console.log(stdout);
if (stderr) {
return Promise.reject(stderr);
}
}
// Install Dependencies
{
const {stdout, stderr} = await exec('npm ci --only=prod', {
cwd: nowPath
});
console.log(stdout);
if (stderr) {
return Promise.reject(stderr);
}
}
const mainTask = require('./src/index');
mainTask();
};
run().catch(console.error);