Skip to content
This repository has been archived by the owner on Jul 7, 2022. It is now read-only.

Commit

Permalink
fix(release): Run release on master only
Browse files Browse the repository at this point in the history
  • Loading branch information
adambrgmn committed Jan 3, 2018
1 parent 96328cb commit 5b20993
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions src/scripts/release.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
const debug = require('debug')('frans:release');
const { isNil, prop } = require('ramda');
const { isNil, prop, has } = require('ramda');
const { toCamelCase } = require('strman');
const hijackCosmiconfig = require('../utils/hijack-cosmiconfig');
const { hasPkgProp } = require('../utils');
const { hasPkgProp, parseEnv } = require('../utils');

const convertArgs = args => {
const getProp = p => prop(p, args);
Expand All @@ -29,14 +29,26 @@ function release(configPath) {
return async args => {
debug('Setup script release');

const hasArg = p => has(p, args);

const useBuiltinConfig = configPath != null && !hasPkgProp('release');
debug(`Use builtin config: ${useBuiltinConfig}`);

const runRelease =
!hasArg('dry-run') &&
parseEnv('TRAVIS', false) &&
process.env.TRAVIS_BRANCH === 'master' &&
!parseEnv('TRAVIS_PULL_REQUEST', false);
debug(`Run release: ${runRelease}`);

if (useBuiltinConfig) {
await hijackCosmiconfig('semantic-release', configPath, 'release');
}

const convertedArgs = convertArgs(args);
const convertedArgs = convertArgs({ ...args, dryRun: !runRelease });

debug('Call semantic release');
debug('With args: %o', convertedArgs);
return require('semantic-release')(convertedArgs);
};
}
Expand Down

0 comments on commit 5b20993

Please sign in to comment.