Something went wrong. Try again.
[READ-ONLY] Mirror of https://github.com/excaliburjs/Excalibur. ๐ฎ Your friendly TypeScript 2D game engine for the web ๐ก๏ธ excaliburjs.com
excalibur excaliburjs game-development game-engine game-framework gamedev games html5-canvas typescript
Something went wrong. Try again.
JavaScript
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106const { execSync } = require('child_process');const readline = require('readline');const semver = require('semver');const { getReleaseVersion } = require('./version');
function generatePatchVersion() { let version = getReleaseVersion(); version = semver.inc(version, 'patch'); return version;}const currentVersion = getReleaseVersion();const version = generatePatchVersion();
const rl = readline.createInterface({ input: process.stdin, output: process.stdout});
function question(theQuestion) { return new Promise((resolve) => rl.question(theQuestion, (answ) => resolve(answ.toLowerCase().includes('y'))));}
async function main() { let answer = false; answer = await question(`Creating an excalibur release at version [v${version}]? (y/n):`); if (answer) { console.log(`Cleaning dist ๐งน`); console.log(execSync(`npm run clean`).toString());
console.log(`Rebuilding with version v${version} ๐จ`); process.env.GH_TOKEN = `v${version}`; process.env.TRAVIS_TAG = `v${version}`; process.env.TRAVIS_BUILD_NUMBER = `v${version}`; console.log(execSync(`npm run build`).toString()); console.log(`Zipping dists ๐ค`); console.log(execSync(`powershell -noprofile "Compress-Archive -Force ./build/dist ./build/dist.${version}.zip"`).toString()); console.log(`Building nuget package ๐ฆ`); console.log(execSync(`npm run nuget ${version}`).toString());
console.log(`Preparing the release notes for Excalibur ๐โ`); console.log(execSync(`git log v${currentVersion}..HEAD --oneline --pretty=format:%s --graph > changes.txt`)); console.log(execSync(`echo Excalibur v${version} Release > title.txt`)); console.log(execSync(`type title.txt .\\assets\\release.md changes.txt > pending-release.md`)); console.log(execSync(`type .\\pending-release.md`).toString()); console.log(`Updating package.json to ${version} ๐`); console.log(execSync(`npm --no-git-tag-version version ${version}`).toString()); console.log('Committing updates โ
'); console.log(execSync(`git add package.json`).toString()); console.log(execSync(`git commit -nm "chore: Release excalibur@v${version}"`).toString());
console.log('Creating releases ๐ค'); const releaseUrl = execSync( [ 'hub release create -d', '--file ./pending-release.md', '--attach ./build/esm/excalibur.js', '--attach ./build/esm/excalibur.d.ts', '--attach ./build/esm/excalibur.min.js', '--attach ./build/esm/excalibur.min.js.map', `--attach ./build/esm/Excalibur.${version}.nupkg`, `--attach ./build/esm.${version}.zip`, `v${version}` ].join(' ') ).toString(); console.log(releaseUrl); console.log(execSync(`"C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe" ${releaseUrl}`)); } else { console.log('Abort!'); rl.close(); return; }
answer = await question('Push the updated package.json? (y/n)'); if (answer) { console.log(execSync(`git push`).toString()); } else { console.log('Abort!'); rl.close(); return; }
answer = await question('Publish the nuget package? (y/n)'); if (answer) { console.log( execSync( `.\\src\\tools\\NuGet.exe push ./build/esm/Excalibur.${version}.nupkg -Source https://api.nuget.org/v3/index.json` ).toString() ); } else { console.log('Abort!'); rl.close(); return; }
answer = await question('Clean working directory? (y/n)'); if (answer) { console.log(execSync(`git clean -f`).toString()); } else { console.log('Abort!'); rl.close(); return; }}
main();