File tree Expand file tree Collapse file tree 2 files changed +9
-21
lines changed Expand file tree Collapse file tree 2 files changed +9
-21
lines changed Original file line number Diff line number Diff line change 1
1
const analyzeCommits = require ( '@semantic-release/commit-analyzer' )
2
2
const SemanticReleaseError = require ( '@semantic-release/error' )
3
3
const execSync = require ( 'child_process' ) . execSync ;
4
+ const lastTag = require ( './lastTag' ) ;
4
5
5
6
const until = f => array => {
6
7
const first = array [ 0 ] ;
@@ -13,15 +14,8 @@ const until = f => array => {
13
14
} ;
14
15
15
16
const lastTaggedRelease = ( ) => {
16
- let sha ;
17
-
18
- try {
19
- sha = execSync ( 'git rev-list -1 `git describe --tags --abbrev=0 --match "v[0-9]*"`' , {
20
- encoding : 'utf8'
21
- } ) . trim ( ) ;
22
- } catch ( e ) { }
23
-
24
- return sha ;
17
+ const tag = lastTag ( { branch : '' , dev : false } ) ;
18
+ execSync ( `git rev-list -1 ${ tag } ` , { encoding : 'utf8' } ) . trim ( ) ;
25
19
} ;
26
20
27
21
module . exports = function ( pluginConfig , config , cb ) {
Original file line number Diff line number Diff line change 1
1
const execSync = require ( 'child_process' ) . execSync ;
2
2
3
- const lastTag = ( ) => {
4
- let sha ;
5
-
6
- try {
7
- sha = execSync (
8
- 'git describe --tags --match "v[0-9]*" --exclude="*dev*" --abbrev=0 origin/master' ,
9
- { encoding : 'utf8' }
10
- ) . trim ( ) ;
11
- } catch ( e ) { }
12
-
13
- return sha ;
14
- }
3
+ const lastTag = ( { branch = 'origin/master' , dev = true } = { } ) => {
4
+ const exclude = dev ? ' --exclude="*dev*"' : '' ;
5
+ return execSync ( `git describe --tags --match "v[0-9]*" ${ exclude } --abbrev=0 ${ branch } || true` ,
6
+ { encoding : 'utf8' }
7
+ ) . trim ( ) ;
8
+ } ;
15
9
16
10
module . exports = lastTag ;
You can’t perform that action at this time.
0 commit comments