travis_github_deployer 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
data/README.md
CHANGED
@@ -3,7 +3,65 @@ Travis to Github Deployer
|
|
3
3
|
|
4
4
|
The Travis to Github Deployer script helps when you want to deploy files from a Travis CI build into a github repository. This is especially useful when you use Github Pages, so that you can push certain build artifacts to the github pages such as coverage, test results or generated documentation
|
5
5
|
|
6
|
-
How does it work
|
7
|
-
|
6
|
+
# How does it work
|
7
|
+
|
8
|
+
The Travis Github Deployer clones a repository and copies files from the build into that repository. It then pushes these files into the github repository.
|
9
|
+
|
10
|
+
## Setting up the Github permissions
|
11
|
+
|
12
|
+
In order for Travis CI to be 'allowed' to push up the changes into a Github repository, you'll need to configure travis CI. The Travis Github Deployer will use the following .travis.yml environment variables:
|
13
|
+
|
14
|
+
* GIT_NAME
|
15
|
+
* GIT_EMAIL
|
16
|
+
* GIT_TOKEN
|
17
|
+
|
18
|
+
You can set up these environment variables in a secure way using the travis gem, in the following way:
|
19
|
+
|
20
|
+
{% highlight bash %}
|
21
|
+
$ gem install travis
|
22
|
+
$ cd <name of your repository>
|
23
|
+
$ curl -u <your username> -d '{"scopes":["public_repo"],"note":"Travis CI deployer"}' https://api.github.com/authorizations
|
24
|
+
$ travis encrypt 'GIT_NAME="<your name>" GIT_EMAIL=<your email> GH_TOKEN=<your token>' --add
|
25
|
+
{% endhighlight %}
|
26
|
+
|
27
|
+
### How does this work?
|
28
|
+
|
29
|
+
The following command:
|
30
|
+
|
31
|
+
{% highlight bash %}
|
32
|
+
$ curl -u <your username> -d '{"scopes":["public_repo"],"note":"Travis CI deployer"}' https://api.github.com/authorizations
|
33
|
+
{% endhighlight %}
|
34
|
+
|
35
|
+
This will get an authentication token. With it, Travis CI can commit under your name. So be careful with it. Then with the following command:
|
36
|
+
|
37
|
+
{% highlight bash %}
|
38
|
+
$ travis encrypt 'GIT_NAME="<your name>" GIT_EMAIL=<your email> GH_TOKEN=<your token>' --add
|
39
|
+
{% endhighlight %}
|
40
|
+
|
41
|
+
This will take the taken and add it to a 'secure' section in your travis.yml. The Travis Github Deployer will grab it from that section and use it to push up the changes to your repository
|
42
|
+
|
43
|
+
## Setting up the Travis Github Deployer
|
44
|
+
|
45
|
+
The Travis Github Deployer uses one config file: ".travis_github_deployer"
|
46
|
+
|
47
|
+
A typical file looks like this:
|
48
|
+
|
49
|
+
{% highlight yaml %}
|
50
|
+
|
51
|
+
destination_repository: https://github.com/basvodde/travis_github_deployer.git
|
52
|
+
|
53
|
+
files_to_deploy:
|
54
|
+
source_dir/source_file: destination_dir/destination_file
|
55
|
+
another_file: another_dir/new_name
|
56
|
+
|
57
|
+
{% endhighlight %}
|
58
|
+
|
59
|
+
This yaml file configures the repository to push to to be travis_github_deployer.git and it will copy 2 files from the build into the repository: source_dir/source_file and another_file. It will copy them to destination: destination_dir/destination_file and another_dir/new_name.
|
60
|
+
|
61
|
+
## Running Travis Github Deployer
|
62
|
+
|
63
|
+
|
64
|
+
|
65
|
+
|
8
66
|
|
9
67
|
|