Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Add Drone.io support #141

Merged
merged 4 commits into from
May 8, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions ci-services/drone.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
'use strict'

const env = process.env

/**
* Should update the `package-lock.json`
*/
function shouldUpdate () {
let re = /^(chore|fix)\(package\): update [^ ]+ to version.*$/mi
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Like Codeship there isn't a good way to get back the current number of commits on the branch so here we're matching the commit message. Might be a good feature request for @bradrydzewski at some point.

return re.test(env.DRONE_COMMIT_MESSAGE)
}

module.exports = {
// The GitHub repo slug
repoSlug: env.DRONE_REPO,
// The name of the current branch
branchName: env.DRONE_COMMIT_BRANCH,
// Is this the first push on this branch
// i.e. the Greenkeeper commit
firstPush: shouldUpdate(),
// Is this a regular build
correctBuild: env.DRONE_BUILD_EVENT === 'push',
// Should the lockfile be uploaded from this build
uploadBuild: env.DRONE_JOB_NUMBER.endsWith('1'),
// The git url
gitUrl: env.DRONE_REMOTE_URL
}
1 change: 1 addition & 0 deletions ci-services/tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ const env = process.env
module.exports = {
buildkite: () => env.BUILDKITE === 'true',
circleci: () => env.CIRCLECI === 'true',
drone: () => env.DRONE === 'true',
jenkins: () => env.JENKINS_URL !== undefined,
travis: () => env.TRAVIS === 'true',
wercker: () => env.WERCKER === 'true',
Expand Down