feat(semantic-release): add initial version of cli
This commit is contained in:
		
							parent
							
								
									17ad82bfbc
								
							
						
					
					
						commit
						fe750f7b9e
					
				
							
								
								
									
										40
									
								
								bin/semantic-release
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										40
									
								
								bin/semantic-release
									
									
									
									
									
										Executable file
									
								
							@ -0,0 +1,40 @@
 | 
				
			|||||||
 | 
					#!/usr/bin/env node
 | 
				
			||||||
 | 
					'use strict'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					var argv = require('minimist')(process.argv.slice(2), {
 | 
				
			||||||
 | 
					  alias: {
 | 
				
			||||||
 | 
					    d: 'debug',
 | 
				
			||||||
 | 
					    dry: 'debug',
 | 
				
			||||||
 | 
					    t: 'token'
 | 
				
			||||||
 | 
					  },
 | 
				
			||||||
 | 
					  default: {
 | 
				
			||||||
 | 
					    token: process.env.GH_TOKEN || process.env.TOKEN || process.env.GITHUB_TOKEN
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					if (~argv._.indexOf('pre')) {
 | 
				
			||||||
 | 
					  console.log('Determining new version')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  return require('../src/pre')(argv, function (err, result) {
 | 
				
			||||||
 | 
					    if (err) {
 | 
				
			||||||
 | 
					      console.log('Something went wrong.')
 | 
				
			||||||
 | 
					      throw err
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if (!result) {
 | 
				
			||||||
 | 
					      console.log('Nothing changed. Not publishing.')
 | 
				
			||||||
 | 
					      process.exit(1)
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    console.log('Publishing v' + result)
 | 
				
			||||||
 | 
					  })
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					if (~argv._.indexOf('post')) {
 | 
				
			||||||
 | 
					  return require('../src/post')(argv, function (err) {
 | 
				
			||||||
 | 
					    if (err) {
 | 
				
			||||||
 | 
					      console.log('Something went wrong.')
 | 
				
			||||||
 | 
					      throw err
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					  })
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user