Updated current version and previous version logic (#554)

no issue

- Use current version from `package.json` instead of `npm_package_version` env variable
- Use `release.tag_name` instead of `release.name` for previous version
This commit is contained in:
Rishabh Garg 2019-10-20 12:05:13 +05:30 committed by GitHub
parent 728392e51e
commit 2eaeba8ba8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -7,6 +7,7 @@ const postcss = require('gulp-postcss');
const zip = require('gulp-zip'); const zip = require('gulp-zip');
const uglify = require('gulp-uglify'); const uglify = require('gulp-uglify');
const beeper = require('beeper'); const beeper = require('beeper');
const fs = require('fs');
// postcss plugins // postcss plugins
const autoprefixer = require('autoprefixer'); const autoprefixer = require('autoprefixer');
@ -130,9 +131,9 @@ const previousRelease = () => {
console.log('No releases found. Skipping'); console.log('No releases found. Skipping');
return; return;
} }
let prevVersion = response[0].tag_name || response[0].name;
console.log(`Previous version ${response[0].name}`); console.log(`Previous version ${prevVersion}`);
return response[0].name; return prevVersion;
}); });
}; };
@ -152,7 +153,9 @@ const previousRelease = () => {
*/ */
const release = () => { const release = () => {
// @NOTE: https://yarnpkg.com/lang/en/docs/cli/version/ // @NOTE: https://yarnpkg.com/lang/en/docs/cli/version/
const newVersion = process.env.npm_package_version; // require(./package.json) can run into caching issues, this re-reads from file everytime on release
var packageJSON = JSON.parse(fs.readFileSync('./package.json'));
const newVersion = packageJSON.version;
let shipsWithGhost = '{version}'; let shipsWithGhost = '{version}';
let compatibleWithGhost = '2.10.0'; let compatibleWithGhost = '2.10.0';
const ghostEnvValues = process.env.GHOST || null; const ghostEnvValues = process.env.GHOST || null;