-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
42 lines (37 loc) · 1.11 KB
/
Copy pathindex.js
File metadata and controls
42 lines (37 loc) · 1.11 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
const core = require('@actions/core');
const ci = require('miniprogram-ci');
(async () => {
try {
const appid = core.getInput('appid');
const privateKey = core.getInput('private_key');
const privateKeyPath = core.getInput('private_key_path');
const projectPath = core.getInput('project_path');
const version = core.getInput('version');
const desc = core.getInput('desc');
const options = {
appid: appid,
type: 'miniProgram',
projectPath: projectPath,
ignores: ['node_modules/**/*'],
}
if (privateKey) {
options.privateKey = privateKey;
} else if (privateKeyPath) {
options.privateKeyPath = privateKeyPath;
}
const project = new ci.Project(options);
const uploadResult = await ci.upload({
project,
version,
desc,
setting: {
es6: true,
},
onProgressUpdate: console.log,
});
core.setOutput('result', uploadResult);
console.log('Upload successful:', uploadResult);
} catch (error) {
core.setFailed(`Upload failed: ${error.message}`);
}
})();