fix scripts

This commit is contained in:
OpportunityLiu
2020-03-20 22:53:43 +08:00
Unverified
parent f8bc635057
commit 470933beed
5 changed files with 29 additions and 20 deletions
Vendored
+10 -7
View File
@@ -4,8 +4,9 @@ const exec_1 = require("@actions/exec");
const io = require("@actions/io");
const os = require("os");
const path = require("path");
exports.folder = path.join(os.tmpdir(), `xmake${Date.now()}`);
const opt = { cwd: exports.folder };
function makeOpt(ref) {
return { cwd: path.join(os.tmpdir(), `xmake-${ref}`) };
}
async function lsRemote() {
let out = '';
await exec_1.exec('git', ['ls-remote', '--tags', 'https://github.com/xmake-io/xmake.git'], {
@@ -25,17 +26,19 @@ async function lsRemote() {
}
exports.lsRemote = lsRemote;
async function create(ref) {
await io.rmRF(exports.folder);
await io.mkdirP(exports.folder);
const opt = makeOpt(ref);
await io.rmRF(opt.cwd);
await io.mkdirP(opt.cwd);
await exec_1.exec('git', ['init'], opt);
await exec_1.exec('git', ['remote', 'add', 'origin', 'https://github.com/xmake-io/xmake.git'], opt);
await exec_1.exec('git', ['fetch'], opt);
await exec_1.exec('git', ['checkout', ref], opt);
await exec_1.exec('git', ['submodule', 'update', '--init', '--recursive'], opt);
return exports.folder;
return opt.cwd;
}
exports.create = create;
async function cleanup() {
await io.rmRF(exports.folder);
async function cleanup(ref) {
const opt = makeOpt(ref);
await io.rmRF(opt.cwd);
}
exports.cleanup = cleanup;
+1 -1
View File
@@ -47,7 +47,7 @@ async function unixInstall(version, sha) {
await exec_1.exec('make', ['install', `prefix=${binDir}`], { cwd: sourceDir });
const cacheDir = await toolCache.cacheDir(binDir, 'xmake', version);
await io.rmRF(binDir);
await git.cleanup();
await git.cleanup(sha);
return cacheDir;
});
}