Skip to content
This repository has been archived by the owner on Jan 14, 2018. It is now read-only.

Commit

Permalink
fix: Do not prevent to run on tag triggered builds
Browse files Browse the repository at this point in the history
No reason to prevent a to run on a tag build. On a tag created by semantic-release, no release will be done as no new commits will be added.
  • Loading branch information
pvdlg committed Nov 25, 2017
1 parent 24b6675 commit fe78cd5
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 42 deletions.
12 changes: 0 additions & 12 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
const {parse} = require('url');
const GitHubApi = require('github');
const parseGithubUrl = require('parse-github-url');
const semver = require('semver');
const deployOnce = require('travis-deploy-once');
const SemanticReleaseError = require('@semantic-release/error');
const resolveConfig = require('./lib/resolve-config');
Expand All @@ -25,17 +24,6 @@ module.exports = async function(pluginConfig, {options: {branch, repositoryUrl}}
);
}

if (process.env.TRAVIS_TAG) {
let errorMessage = 'This test run was triggered by a git tag and therefore a new version won’t be published.';

if (semver.valid(process.env.TRAVIS_TAG)) {
errorMessage +=
'\nIt is very likely that this tag was created by semantic-release itself.\nEverything is okay. For log output of the actual publishing process look at the build that ran before this one.';
}

throw new SemanticReleaseError(errorMessage, 'EGITTAG');
}

if (branch !== process.env.TRAVIS_BRANCH) {
throw new SemanticReleaseError(
`This test run was triggered on the branch ${
Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
"@semantic-release/error": "^2.0.0",
"github": "^12.0.0",
"parse-github-url": "^1.0.1",
"semver": "^5.0.3",
"travis-deploy-once": "^3.0.0"
},
"devDependencies": {
Expand Down
29 changes: 0 additions & 29 deletions test/condition-travis-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ test.beforeEach(t => {
delete process.env.GITHUB_PREFIX;
delete process.env.TRAVIS;
delete process.env.TRAVIS_PULL_REQUEST;
delete process.env.TRAVIS_TAG;
delete process.env.TRAVIS_BRANCH;
delete process.env.TRAVIS;
});
Expand Down Expand Up @@ -53,34 +52,6 @@ test.serial('Not running on pull requests', async t => {
t.true(travisDeployOnce.notCalled);
});

test.serial('Not running on tags', async t => {
const travisDeployOnce = stub();
const condition = proxyquire('../', {'travis-deploy-once': travisDeployOnce});
process.env.TRAVIS = 'true';
process.env.TRAVIS_PULL_REQUEST = 'false';
process.env.TRAVIS_TAG = 'v1.0.0';

const error = await t.throws(condition({}, {options: {}}));

t.true(error instanceof SemanticReleaseError);
t.is(error.code, 'EGITTAG');
t.true(travisDeployOnce.notCalled);
});

test.serial('Not running on tags that don’t look like semantic versions', async t => {
const travisDeployOnce = stub();
const condition = proxyquire('../', {'travis-deploy-once': travisDeployOnce});
process.env.TRAVIS = 'true';
process.env.TRAVIS_PULL_REQUEST = 'false';
process.env.TRAVIS_TAG = 'vfoo';

const error = await t.throws(condition({}, {options: {}}));

t.true(error instanceof SemanticReleaseError);
t.is(error.code, 'EGITTAG');
t.true(travisDeployOnce.notCalled);
});

test.serial('Does not run on non-master branch by default', async t => {
const travisDeployOnce = stub();
const condition = proxyquire('../', {'travis-deploy-once': travisDeployOnce});
Expand Down

0 comments on commit fe78cd5

Please sign in to comment.