fix scripts
This commit is contained in:
Vendored
+10
-7
@@ -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;
|
||||
|
||||
Vendored
+1
-1
@@ -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;
|
||||
});
|
||||
}
|
||||
|
||||
+7
-4
@@ -1,16 +1,19 @@
|
||||
{
|
||||
"name": "github-action-setup-xmake",
|
||||
"version": "1.0.1",
|
||||
"version": "1.0.3",
|
||||
"description": "Set up your GitHub Actions workflow with a specific version of xmake",
|
||||
"main": "dist/index.js",
|
||||
"author": "OpportunityLiu",
|
||||
"license": "GPL-3.0-or-later",
|
||||
"repository": "https://github.com/xmake-io/github-action-setup-xmake.git",
|
||||
"homepage": "https://github.com/xmake-io/github-action-setup-xmake",
|
||||
"scripts": {
|
||||
"clean": "rimraf dist",
|
||||
"init": "yarn install && yarn clean",
|
||||
"watch": "tsc --watch",
|
||||
"lint": "eslint --fix src/**/*",
|
||||
"build": "tsc --build ./tsconfig.build.json",
|
||||
"rebuild":"yarn clean && yarn build",
|
||||
"rebuild": "yarn clean && yarn build",
|
||||
"clean": "rimraf dist",
|
||||
"lint": "eslint --fix src/**/*",
|
||||
"test": "jest",
|
||||
"release": "yarn rebuild && yarn lint && yarn install --production"
|
||||
},
|
||||
|
||||
+10
-7
@@ -3,8 +3,9 @@ import * as io from '@actions/io';
|
||||
import * as os from 'os';
|
||||
import * as path from 'path';
|
||||
|
||||
export const folder = path.join(os.tmpdir(), `xmake${Date.now()}`);
|
||||
const opt = { cwd: folder };
|
||||
function makeOpt(ref: string): { cwd: string } {
|
||||
return { cwd: path.join(os.tmpdir(), `xmake-${ref}`) };
|
||||
}
|
||||
|
||||
export async function lsRemote(): Promise<Record<string, string>> {
|
||||
let out = '';
|
||||
@@ -25,16 +26,18 @@ export async function lsRemote(): Promise<Record<string, string>> {
|
||||
}
|
||||
|
||||
export async function create(ref: string): Promise<string> {
|
||||
await io.rmRF(folder);
|
||||
await io.mkdirP(folder);
|
||||
const opt = makeOpt(ref);
|
||||
await io.rmRF(opt.cwd);
|
||||
await io.mkdirP(opt.cwd);
|
||||
await exec('git', ['init'], opt);
|
||||
await exec('git', ['remote', 'add', 'origin', 'https://github.com/xmake-io/xmake.git'], opt);
|
||||
await exec('git', ['fetch'], opt);
|
||||
await exec('git', ['checkout', ref], opt);
|
||||
await exec('git', ['submodule', 'update', '--init', '--recursive'], opt);
|
||||
return folder;
|
||||
return opt.cwd;
|
||||
}
|
||||
|
||||
export async function cleanup(): Promise<void> {
|
||||
await io.rmRF(folder);
|
||||
export async function cleanup(ref: string): Promise<void> {
|
||||
const opt = makeOpt(ref);
|
||||
await io.rmRF(opt.cwd);
|
||||
}
|
||||
|
||||
+1
-1
@@ -47,7 +47,7 @@ async function unixInstall(version: string, sha: string): Promise<void> {
|
||||
await 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;
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user