Skip to content

Commit f1fae3c

Browse files
committed
chore(gulp): Fixed git tag for release
1 parent 8fef1f8 commit f1fae3c

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

tools/gulp/release/release-git.task.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,11 @@ const fs = require( 'fs' );
44
const git = require( 'gulp-git' );
55
const gulp = require( 'gulp' );
66

7-
const newVersion = require( './../../../package.json' ).version;
8-
97
/**
108
* Gulp task: Commit all changes (the package and changelog files)
119
*/
1210
gulp.task( 'release:git:commit', ( done ) => {
11+
const newVersion = getPackageJsonVersion();
1312
gulp
1413
.src( [ // Only package and changelog
1514
'package.json',
@@ -27,6 +26,7 @@ gulp.task( 'release:git:commit', ( done ) => {
2726
* Gulp task: Tag the current commit with the new version
2827
*/
2928
gulp.task( 'release:git:tag', ( done ) => {
29+
const newVersion = getPackageJsonVersion();
3030
git.tag( `${ newVersion }`, `Release of version ${ newVersion }.`, { quiet: true }, done );
3131
} );
3232

@@ -45,3 +45,10 @@ gulp.task( 'release:git', gulp.series( [
4545
'release:git:tag',
4646
'release:git:push'
4747
] ) );
48+
49+
/**
50+
* Read the package.json version (do not require, prevents cached results)
51+
*/
52+
function getPackageJsonVersion() {
53+
return JSON.parse( fs.readFileSync( `${ options.paths.package.path }${ options.paths.package.file }`, 'utf-8' ) ).version;
54+
}

0 commit comments

Comments
 (0)