ghdeploy 0.1.6 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +12 -9
- data/lib/ghdeploy/cli.rb +1 -1
- data/lib/ghdeploy/repo_fact_finder.rb +10 -0
- data/lib/ghdeploy/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6b7337590fe342d7eb0847bfc0db55f427fa21ee
|
4
|
+
data.tar.gz: caae3973494652dd50d238456cecbe7d1cb0eb7c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c52cfbd42ea137d34b85b55bd455c39e967832b36e37fea95a40f5239b2ff99ed00ecfe841de6d03428865b6b25bbafafe2b2cd7e54dd06f461166326d40b902
|
7
|
+
data.tar.gz: 335e4db5a62e75f9b90290624b322fed40fd7112cd4d84d79c241cdfc59d070a67356842c8c6aaec8b7b1cb82550b11967887a043e3c5c03b477ddbe1160ee2b
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -6,7 +6,17 @@ This gem adds a command to git for publishing [GitHub deployments](https://devel
|
|
6
6
|
|
7
7
|
```ruby
|
8
8
|
gem install 'ghdeploy'
|
9
|
-
|
9
|
+
```
|
10
|
+
|
11
|
+
# Setup
|
12
|
+
The only additional setup is to create a [personal access token](https://github.com/settings/tokens) in Github and set the environment variable.
|
13
|
+
```
|
14
|
+
export GHDEPLOY_TOKEN=<token-from-github>
|
15
|
+
```
|
16
|
+
If you're using an internal github server, you'll want to specify a host-specific token.
|
17
|
+
For example, if you're internal host is `https://my-enterprise-github.com`, then specify a token like so:
|
18
|
+
```
|
19
|
+
export GHDEPLOY_MY_ENTERPRISE_GITHUB_COM_TOKEN=<token-from-internal-github>
|
10
20
|
```
|
11
21
|
|
12
22
|
## Usage
|
@@ -15,12 +25,5 @@ From within a git repository run:
|
|
15
25
|
|
16
26
|
Basic deploy of master branch to production:
|
17
27
|
```
|
18
|
-
git deploy
|
19
|
-
```
|
20
|
-
|
21
|
-
More specific:
|
22
|
-
```
|
23
|
-
git deploy origin branch-name \
|
24
|
-
--environment staging \
|
25
|
-
--description "Short description"
|
28
|
+
git deploy production master
|
26
29
|
```
|
data/lib/ghdeploy/cli.rb
CHANGED
@@ -15,7 +15,7 @@ module Ghdeploy
|
|
15
15
|
|
16
16
|
facts = RepoFactFinder.new(remote_name)
|
17
17
|
Octokit.configure { |c| c.api_endpoint = facts.host }
|
18
|
-
client = Octokit::Client.new(access_token:
|
18
|
+
client = Octokit::Client.new(access_token: facts.token)
|
19
19
|
deployment = client.create_deployment(facts.repo, ref, environment: environment)
|
20
20
|
puts "Deployment created!" if deployment.url
|
21
21
|
end
|
@@ -28,6 +28,16 @@ class RepoFactFinder
|
|
28
28
|
@repo = repo.gsub(/(\.git)$/, '')
|
29
29
|
end
|
30
30
|
|
31
|
+
def token
|
32
|
+
github_host = host.gsub(/^http[s]?:\/\/api\./, '')
|
33
|
+
if github_host == 'github.com'
|
34
|
+
ENV.fetch('GHDEPLOY_TOKEN')
|
35
|
+
else
|
36
|
+
key = github_host.gsub(/[\.\-]/, '_').upcase
|
37
|
+
ENV.fetch("GHDEPLOY_#{key}_TOKEN")
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
31
41
|
private
|
32
42
|
|
33
43
|
def url
|
data/lib/ghdeploy/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ghdeploy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brandon Joyce
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-09-
|
11
|
+
date: 2018-09-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|