Skip to content

Commit e897121

Browse files
committed
fix: do not modify npm tag permanently
1 parent e1a2656 commit e897121

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

getLastRelease.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ const defaultLastRelease = require('@semantic-release/last-release-npm');
22

33
module.exports = function (pluginConfig, config, cb) {
44
let branch;
5+
let oldTag;
56

67
if (config.env.TRAVIS) {
78
branch = config.env.TRAVIS_BRANCH;
@@ -12,9 +13,15 @@ module.exports = function (pluginConfig, config, cb) {
1213
const distTag = config.options.branchTags[branch];
1314
if (distTag) {
1415
// use 'latest' dist tag to determine what version will be published
16+
oldTag = config.npm.tag;
1517
config.npm.tag = "latest";
1618
}
1719

18-
return defaultLastRelease(pluginConfig, config, cb);
20+
return defaultLastRelease(pluginConfig, config, function(err, res) {
21+
if (distTag) {
22+
config.npm.tag = oldTag;
23+
}
24+
cb(err, res);
25+
});
1926
};
2027

0 commit comments

Comments
 (0)