Ensure GIT_COMMIT_SHA is valid

master
Futago-za Ryuu 5 years ago
parent 910a51bf5f
commit 42514c4951

@ -19,12 +19,19 @@ const VERSION = require( packagejson ).version;
const { const {
GIT_BRANCH, GIT_BRANCH,
GIT_COMMIT_SHA,
NPM_TOKEN, NPM_TOKEN,
PR_BRANCH, PR_BRANCH,
} = process.env; } = process.env;
let {
GIT_COMMIT_SHA,
} = process.env;
if ( GIT_COMMIT_SHA === "not-found" ) GIT_COMMIT_SHA = GIT_BRANCH;
// local helpers // local helpers
function die( err ) { function die( err ) {
@ -59,7 +66,7 @@ if ( ! NPM_TOKEN ) die( "`process.env.NPM_TOKEN` is required by " + APP );
// update version field in `pegjs/package.json` // update version field in `pegjs/package.json`
const GIT_COMMIT_SHORT_SHA = exec( "git rev-parse --short " + GIT_COMMIT_SHA || GIT_BRANCH, false ); const GIT_COMMIT_SHORT_SHA = exec( "git rev-parse --short " + GIT_COMMIT_SHA, false );
const dev = `${ VERSION }-${ GIT_BRANCH }.${ GIT_COMMIT_SHORT_SHA }`; const dev = `${ VERSION }-${ GIT_BRANCH }.${ GIT_COMMIT_SHORT_SHA }`;
exec( `npm --no-git-tag-version -f version ${ dev }` ); exec( `npm --no-git-tag-version -f version ${ dev }` );

Loading…
Cancel
Save