mirror of
https://github.com/ineedbots/iw4_bot_warfare.git
synced 2025-03-15 07:26:56 +00:00
Add deploy scripts
This commit is contained in:
parent
a2f9f1f9ee
commit
59903db458
4
.gitignore
vendored
4
.gitignore
vendored
@ -23,6 +23,10 @@
|
||||
!/out
|
||||
|
||||
!/.astylerc
|
||||
!/z_deploy.bat
|
||||
!/deploy.bat
|
||||
!/deploy.js
|
||||
|
||||
*.zip
|
||||
*.log
|
||||
*.stat
|
||||
|
5
deploy.bat
Normal file
5
deploy.bat
Normal file
@ -0,0 +1,5 @@
|
||||
xcopy iw4x_bot_warfare\userraw\maps userraw\maps\ /Y /I /E /H /C
|
||||
xcopy iw4x_bot_warfare\userraw\scripts userraw\scripts\ /Y /I /E /H /C
|
||||
xcopy iw4x_bot_warfare\userraw\waypoints userraw\waypoints\ /Y /I /E /H /C
|
||||
xcopy iw4x_bot_warfare\userraw\mp userraw\mp\ /Y /I /E /H /C
|
||||
xcopy iw4x_bot_warfare\userraw\bots.txt userraw\ /Y /I /H /C
|
34
deploy.js
Normal file
34
deploy.js
Normal file
@ -0,0 +1,34 @@
|
||||
// nodejs 14+
|
||||
|
||||
const exec = require('util').promisify(require('child_process').exec)
|
||||
|
||||
const repo_name = 'iw4x_bot_warfare'
|
||||
const repo_url = `https://github.com/ineedbots/${repo_name}`
|
||||
const deploy_check_rate = 60000
|
||||
|
||||
async function doDeploy() {
|
||||
try {
|
||||
const { stdout, stderr } = await exec(`cd ${repo_name} && git fetch`)
|
||||
|
||||
if (stderr.length <= 0)
|
||||
return
|
||||
|
||||
if (stderr.startsWith('From '))
|
||||
{
|
||||
console.log(Date.now(), 'git fetched! pulling and deploying...')
|
||||
await exec(`cd ${repo_name} && git pull && git submodule update --init --recursive`)
|
||||
await exec('deploy.bat')
|
||||
}
|
||||
} catch (e) {
|
||||
console.error(e); // should contain code (exit code) and signal (that caused the termination).
|
||||
|
||||
console.log('Cloning...')
|
||||
try {
|
||||
await exec(`git clone ${repo_url} && cd ${repo_name} && git submodule update --init --recursive`)
|
||||
} catch (f) {
|
||||
console.error(f)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
setInterval(doDeploy, deploy_check_rate)
|
1
z_deploy.bat
Normal file
1
z_deploy.bat
Normal file
@ -0,0 +1 @@
|
||||
start "" "node" deploy.js
|
Loading…
x
Reference in New Issue
Block a user