@@ -11,33 +11,44 @@ const logger = require('vx/logger');
1111const packageNames = require ( 'vx/packageNames' ) ;
1212const vxPath = require ( 'vx/vxPath' ) ;
1313
14- const SCRIPT_PATH = path . resolve (
14+ const RELEASE_SCRIPTS = path . resolve (
1515 vxPath . VX_SCRIPTS_PATH ,
1616 'release' ,
17- 'steps' ,
17+ 'steps'
18+ ) ;
19+
20+ const PUSH_TO_LATEST_BRANCH = path . resolve (
21+ RELEASE_SCRIPTS ,
1822 'push_to_latest_branch.sh'
1923) ;
2024
25+ const CREATE_GIT_TAG = path . resolve ( RELEASE_SCRIPTS , 'create_git_tag.sh' ) ;
26+
2127const EMOJIS = [ '🚀' , '🦺' , '🤘' , '✨' , '🌈' , '✅' ] ;
2228
23- function pushToLatestBranch ( ) {
29+ function commitChangesToGit ( ) {
2430 logger . info ( '🌎 Pushing latest branch.' ) ;
2531
2632 const allChanges = listAllChangesSinceStableBranch ( ) ;
2733 const changedPackages = filterChangedPackages ( allChanges ) ;
34+
35+ pushToLatestBranch ( allChanges , changedPackages ) ;
36+ createTags ( changedPackages ) ;
37+ }
38+
39+ module . exports = commitChangesToGit ;
40+
41+ function pushToLatestBranch ( allChanges , changedPackages ) {
2842 const messages = allChanges . map ( ( { title } ) => title ) ;
29- const command = [
43+
44+ exec ( [
3045 'sh' ,
31- SCRIPT_PATH ,
46+ PUSH_TO_LATEST_BRANCH ,
3247 `"${ createCommitMessage ( changedPackages ) } "` ,
3348 `"${ messages . join ( '\n' ) } "` ,
34- ] . join ( ' ' ) ;
35-
36- exec ( command ) ;
49+ ] ) ;
3750}
3851
39- module . exports = pushToLatestBranch ;
40-
4152function filterChangedPackages ( commits ) {
4253 return packageNames . list . filter ( packageName => {
4354 return commits . some ( ( { title, files } ) => {
@@ -60,3 +71,12 @@ function createCommitMessage(changedPackages) {
6071
6172 return `${ sample ( EMOJIS ) } Updating: ${ msg } ` ;
6273}
74+
75+ function createTags ( changedPackages ) {
76+ return changedPackages . forEach ( packageName => {
77+ const version = packageJson ( packageName ) . version ;
78+ const tag = `${ packageName } @${ version } ` ;
79+
80+ exec ( [ 'sh' , CREATE_GIT_TAG , tag ] ) ;
81+ } ) ;
82+ }
0 commit comments