Skip to content

Commit

Permalink
feat: basic bitrise support
Browse files Browse the repository at this point in the history
  • Loading branch information
zetaron committed Aug 24, 2017
1 parent e4ba1a3 commit 06622b1
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 1 deletion.
29 changes: 29 additions & 0 deletions ci-services/bitrise.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
const gitHelpers = require('../lib/git-helpers')

const env = process.env

// http://devcenter.bitrise.io/faq/available-environment-variables/

function parseRepoSlug(repoUrl) {
const repoUrlWithoutGitExtension = repoUrl.replace('.git', '')
const lastSegmentOfRepoUrl = repoUrlWithoutGitExtension.split(':').pop() // split at protocoll eg. git://... or git@github.com:... and only retain the relevant last segment
const splitAtSlash = lastSegmentOfRepoUrl.split('/')
const repoName = splitAtSlash.pop()
const repoOwner = splitAtSlash.pop()

return `${repoOwner}/${repoName}`
}

module.exports = {
// The GitHub repo slug
repoSlug: parseRepoSlug(env.GIT_REPOSITORY_URL),
// The name of the current branch
branchName: env.BITRISE_GIT_BRANCH,
// Is this the first push on this branch
// i.e. the Greenkeeper commit
firstPush: gitHelpers.getNumberOfCommitsOnBranch(env.BITRISE_GIT_BRANCH) === 1,
// Is this a regular build
correctBuild: env.PR === 'false',
// Should the lockfile be uploaded from this build
uploadBuild: true
}
3 changes: 2 additions & 1 deletion ci-services/tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@ module.exports = {
circleci: () => env.CIRCLECI === 'true',
jenkins: () => env.JENKINS_URL !== undefined,
travis: () => env.TRAVIS === 'true',
wercker: () => env.WERCKER === 'true'
wercker: () => env.WERCKER === 'true',
bitrise: () => env.CI === 'true' && env.BITRISE_BUILD_NUMBER !== ''
}

0 comments on commit 06622b1

Please # to comment.