fixes
This commit is contained in:
@@ -1,3 +1,4 @@
|
|||||||
GIT_URI=ssh://git@git.aaro.dev:30009/aarov/vrcboard-website.git
|
#GIT_URI=ssh://git@git.domain/username/example-repo.git
|
||||||
|
GIT_URI=https://<username>:<token>@git.domain/username/example-repo.git
|
||||||
GIT_BRANCH=main
|
GIT_BRANCH=main
|
||||||
#COMMANDS="['npm i','npm start']"
|
#COMMANDS="['npm i','npm start']"
|
||||||
24
index.js
24
index.js
@@ -3,18 +3,28 @@ const fs = require('fs')
|
|||||||
const simpleGit = require("simple-git")
|
const simpleGit = require("simple-git")
|
||||||
const path = require("path")
|
const path = require("path")
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param {String} a
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
function resolvePath(a) {
|
||||||
|
a = a.replace("\\",path.sep)
|
||||||
|
return path.resolve(a)
|
||||||
|
}
|
||||||
|
|
||||||
require("dotenv").config()
|
require("dotenv").config()
|
||||||
|
|
||||||
const GIT_URI = process.env.GIT_URI
|
const GIT_URI = process.env.GIT_URI
|
||||||
const GIT_BRANCH = process.env.GIT_BRANCH || "main"
|
const GIT_BRANCH = process.env.GIT_BRANCH || "main"
|
||||||
|
|
||||||
const PROJECT_DIR = path.resolve(__dirname + "\\project")
|
const PROJECT_DIR = resolvePath(__dirname + "\\project")
|
||||||
|
|
||||||
const KEY_DIR = path.resolve(__dirname + "\\keys")
|
const KEY_DIR = resolvePath(__dirname + "\\keys")
|
||||||
|
|
||||||
const KEY_LOCATION = path.resolve(KEY_DIR + "\\deploy.pem")
|
const KEY_LOCATION = resolvePath(KEY_DIR + "\\deploy.pem")
|
||||||
const KEY_LOCATION_PUBLIC = path.resolve(KEY_LOCATION+".pub")
|
const KEY_LOCATION_PUBLIC = resolvePath(KEY_LOCATION+".pub")
|
||||||
const KNOWN_HOSTS_FILE = path.resolve(__dirname + "\\known_hosts")
|
const KNOWN_HOSTS_FILE = resolvePath(__dirname + "\\known_hosts")
|
||||||
|
|
||||||
const KEY_FORMAT = "PEM"
|
const KEY_FORMAT = "PEM"
|
||||||
const KEY_COMMENT = "nodejs-deploy"
|
const KEY_COMMENT = "nodejs-deploy"
|
||||||
@@ -57,6 +67,7 @@ async function tryGenerateKeys() {
|
|||||||
function onDoneCallback(err, out) {
|
function onDoneCallback(err, out) {
|
||||||
// The error could be related to ssh-keygen binary or file system errors.
|
// The error could be related to ssh-keygen binary or file system errors.
|
||||||
if (err) {
|
if (err) {
|
||||||
|
console.error(err)
|
||||||
reject(err);
|
reject(err);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -105,10 +116,11 @@ async function gitMain() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const { execSync, spawn } = require('child_process')
|
||||||
|
|
||||||
async function ProjectCmd(cmd) {
|
async function ProjectCmd(cmd) {
|
||||||
//console.log(`executing "${cmd}"`)
|
//console.log(`executing "${cmd}"`)
|
||||||
const processPromise = new Promise(function(resolve, reject) {
|
const processPromise = new Promise(function(resolve, reject) {
|
||||||
const spawn = require('child_process').spawn;
|
|
||||||
const process = spawn(cmd, { stdio: 'inherit', cwd: PROJECT_DIR, shell:true });
|
const process = spawn(cmd, { stdio: 'inherit', cwd: PROJECT_DIR, shell:true });
|
||||||
|
|
||||||
process.on('close', (code) => {
|
process.on('close', (code) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user