Skip to content

Commit

Permalink
created deploy github-status
Browse files Browse the repository at this point in the history
  • Loading branch information
aureliosaraiva committed Aug 19, 2017
1 parent c6920fd commit 48a0008
Show file tree
Hide file tree
Showing 4 changed files with 222 additions and 0 deletions.
23 changes: 23 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# See https://help.github.com/ignore-files/ for more about ignoring files.

# compiled output
/dist
/tmp

# dependencies
/node_modules
/bower_components

# misc
/.sass-cache
/connect.lock
/coverage/*
/libpeerconnection.log
npm-debug.log*
yarn-error.log
testem.log

# ember-try
.node_modules.ember-try/
bower.json.ember-try
package.json.ember-try
46 changes: 46 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
'use strict';

const GitHubApi = require('github');
const DeployPluginBase = require('ember-cli-deploy-plugin');

module.exports = {
name: 'ember-cli-deploy-github-deployments',
createDeployPlugin(options) {
var DeployPlugin = DeployPluginBase.extend({
name: options.name,
requiredConfig: ['publicURL', 'token', 'userOrOrganization', 'repo', 'commitSha'],

didDeploy(context) {
return this.notifyPullRequestOfDeploy(context);
},

notifyPullRequestOfDeploy(context) {
let github = new GitHubApi();

github.authenticate({
type: 'oauth',
token: this.readConfig('token'),
});

return new Promise((resolve, reject) => {
github.repos.createStatus({
owner: this.readConfig('userOrOrganization'),
repo: this.readConfig('repo'),
sha: this.readConfig('commitSha'),
state: 'success',
target_url: this.readConfig('publicURL'),
context: 'ember-cli-deploy',
}, (error, result) => {
if (error) {
reject(error);
} else {
resolve(result);
}
});
});
},
});

return new DeployPlugin();
},
};
23 changes: 23 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"name": "ember-cli-deploy-github-deployments",
"version": "0.1.0",
"description": "",
"scripts": {},
"repository": "https://github.com/aureliosaraiva/ember-cli-deploy-github-deployments",
"engines": {
"node": ">= 4.x.x"
},
"author": "Aurelio Saraiva",
"license": "MIT",
"keywords": [
"ember-cli-deploy-plugin"
],
"dependencies": {
"ember-cli-deploy-plugin": "^0.2.9",
"github": "^9.2.0",
"urlencode": "^1.1.0"
},
"ember-addon": {
"configPath": "tests/dummy/config"
}
}
130 changes: 130 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
# yarn lockfile v1


agent-base@2:
version "2.1.1"
resolved "https://registry.yarnpkg.com/agent-base/-/agent-base-2.1.1.tgz#d6de10d5af6132d5bd692427d46fc538539094c7"
dependencies:
extend "~3.0.0"
semver "~5.0.1"

ansi-regex@^2.0.0:
version "2.1.1"
resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-2.1.1.tgz#c3b33ab5ee360d86e0e628f0468ae7ef27d654df"

ansi-styles@^2.2.1:
version "2.2.1"
resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-2.2.1.tgz#b432dd3358b634cf75e1e4664368240533c1ddbe"

chalk@^1.0.0, chalk@^1.1.3:
version "1.1.3"
resolved "https://registry.yarnpkg.com/chalk/-/chalk-1.1.3.tgz#a8115c55e4a702fe4d150abd3872822a7e09fc98"
dependencies:
ansi-styles "^2.2.1"
escape-string-regexp "^1.0.2"
has-ansi "^2.0.0"
strip-ansi "^3.0.0"
supports-color "^2.0.0"

core-object@2.0.6:
version "2.0.6"
resolved "https://registry.yarnpkg.com/core-object/-/core-object-2.0.6.tgz#60134b9c40ff69b27bc15e82db945e4df782961b"
dependencies:
chalk "^1.1.3"

debug@2, debug@^2.2.0:
version "2.6.8"
resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.8.tgz#e731531ca2ede27d188222427da17821d68ff4fc"
dependencies:
ms "2.0.0"

ember-cli-deploy-plugin@^0.2.9:
version "0.2.9"
resolved "https://registry.yarnpkg.com/ember-cli-deploy-plugin/-/ember-cli-deploy-plugin-0.2.9.tgz#a3d395b8adad7ef68d8bacdd0b0f4a61bcf9e651"
dependencies:
chalk "^1.0.0"
core-object "2.0.6"
lodash.clonedeep "^4.5.0"

escape-string-regexp@^1.0.2:
version "1.0.5"
resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4"

extend@3, extend@~3.0.0:
version "3.0.1"
resolved "https://registry.yarnpkg.com/extend/-/extend-3.0.1.tgz#a755ea7bc1adfcc5a31ce7e762dbaadc5e636444"

follow-redirects@0.0.7:
version "0.0.7"
resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-0.0.7.tgz#34b90bab2a911aa347571da90f22bd36ecd8a919"
dependencies:
debug "^2.2.0"
stream-consume "^0.1.0"

github@^9.2.0:
version "9.2.0"
resolved "https://registry.yarnpkg.com/github/-/github-9.2.0.tgz#8a886dc40dd63636707dcaf99df3df26c59f16fc"
dependencies:
follow-redirects "0.0.7"
https-proxy-agent "^1.0.0"
mime "^1.2.11"
netrc "^0.1.4"

has-ansi@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/has-ansi/-/has-ansi-2.0.0.tgz#34f5049ce1ecdf2b0649af3ef24e45ed35416d91"
dependencies:
ansi-regex "^2.0.0"

https-proxy-agent@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/https-proxy-agent/-/https-proxy-agent-1.0.0.tgz#35f7da6c48ce4ddbfa264891ac593ee5ff8671e6"
dependencies:
agent-base "2"
debug "2"
extend "3"

iconv-lite@~0.4.11:
version "0.4.18"
resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.18.tgz#23d8656b16aae6742ac29732ea8f0336a4789cf2"

lodash.clonedeep@^4.5.0:
version "4.5.0"
resolved "https://registry.yarnpkg.com/lodash.clonedeep/-/lodash.clonedeep-4.5.0.tgz#e23f3f9c4f8fbdde872529c1071857a086e5ccef"

mime@^1.2.11:
version "1.3.6"
resolved "https://registry.yarnpkg.com/mime/-/mime-1.3.6.tgz#591d84d3653a6b0b4a3b9df8de5aa8108e72e5e0"

ms@2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8"

netrc@^0.1.4:
version "0.1.4"
resolved "https://registry.yarnpkg.com/netrc/-/netrc-0.1.4.tgz#6be94fcaca8d77ade0a9670dc460914c94472444"

semver@~5.0.1:
version "5.0.3"
resolved "https://registry.yarnpkg.com/semver/-/semver-5.0.3.tgz#77466de589cd5d3c95f138aa78bc569a3cb5d27a"

stream-consume@^0.1.0:
version "0.1.0"
resolved "https://registry.yarnpkg.com/stream-consume/-/stream-consume-0.1.0.tgz#a41ead1a6d6081ceb79f65b061901b6d8f3d1d0f"

strip-ansi@^3.0.0:
version "3.0.1"
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-3.0.1.tgz#6a385fb8853d952d5ff05d0e8aaf94278dc63dcf"
dependencies:
ansi-regex "^2.0.0"

supports-color@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-2.0.0.tgz#535d045ce6b6363fa40117084629995e9df324c7"

urlencode@^1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/urlencode/-/urlencode-1.1.0.tgz#1f2ba26f013c85f0133f7a3ad6ff2730adf7cbb7"
dependencies:
iconv-lite "~0.4.11"

0 comments on commit 48a0008

Please sign in to comment.