-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.mjs
More file actions
52 lines (41 loc) · 1.55 KB
/
Copy pathindex.mjs
File metadata and controls
52 lines (41 loc) · 1.55 KB
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
52
import * as path from 'node:path';
import * as url from 'node:url';
import * as core from '@actions/core';
import * as exec from '@actions/exec';
const __dirname = path.dirname(url.fileURLToPath(import.meta.url));
const setupPs1 = path.resolve(__dirname, '../setup.ps1');
const cleanupPs1 = path.resolve(__dirname, '../cleanup.ps1');
const isPost = core.getState('IsPost');
core.saveState('IsPost', true);
const connectionStringName = core.getInput('connection-string-name', { required: true });
const imageTag = core.getInput('image-tag') || '9.4.5.1-r1';
const initScript = core.getInput('init-script');
async function run() {
try {
if (!isPost) {
console.log('Running setup action');
const containerName = 'ibmmq';
core.saveState('ContainerName', containerName);
console.log(`containerName = ${containerName}`);
console.log(`imageTag = ${imageTag}`);
await exec.exec('pwsh', [
'-File', setupPs1,
'-ContainerName', containerName,
'-ConnectionStringName', connectionStringName,
'-ImageTag', imageTag,
'-InitScript', initScript
]);
} else {
console.log('Running cleanup');
const containerName = core.getState('ContainerName');
await exec.exec('pwsh', [
'-File', cleanupPs1,
'-ContainerName', containerName
]);
}
} catch (err) {
core.setFailed(err);
console.log(err);
}
}
run();