This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* checking if branch exists in builds repository */ | |
const isBranchExits = !!spawnSync( | |
'git', | |
['ls-remote', '--exit-code', 'origin', buildBranch], | |
getSpawnOptions(tempDir, 'pipe') | |
).stdout.toString().trim(); | |
if (isBranchExits) { | |
/* checkout the target branch */ | |
spawnSync('git', ['fetch', 'origin', buildBranch], getSpawnOptions(tempDir)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* checking if the created tag exists in build repository */ | |
const isTagExists = !!spawnSync( | |
'git', | |
['ls-remote', 'origin', `refs/tags/${tag}`], | |
getSpawnOptions(tempDir, 'pipe') | |
).stdout.toString().trim(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const tag = buildBranch === 'master' ? version : `${version}_${shortSHA}`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Shortened hash of the last commit in source code repository. | |
Used for forming of the unstable version tag */ | |
const shortSHA = spawnSync( | |
'git', | |
['rev-parse', '--short', 'HEAD'], | |
getSpawnOptions(rootDir, 'pipe') | |
).stdout.toString().trim(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* current branch name in the module source code repository */ | |
const branch = spawnSync( | |
'git', | |
['symbolic-ref', '--short', 'HEAD'], | |
getSpawnOptions(rootDir, 'pipe') | |
).stdout.toString().trim(); | |
/* branch name in the builds repository */ | |
const buildBranch = branch === 'develop' ? 'master' : branch; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* temporary directory for the builds repository */ | |
const tempDir = join(rootDir, 'temp'); | |
if (existsSync(tempDir)) { | |
spawnSync('rm', ['-rf', 'temp'], getSpawnOptions(rootDir)); | |
} | |
mkdirSync(tempDir); | |
/* getting parameters from the package.json */ | |
const { name, version, repository } = require(join(rootDir, 'package.json')); | |
const originUrl = repository.url.replace(`${name}-source`, name); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const isDiff = !!spawnSync('git', ['diff'], getSpawnOptions(rootDir, 'pipe')).stdout.toString().trim(); |
NewerOlder