Skip to content

Commit 3c2f958

Browse files
committed
ghpages.clean is now always called - more or less, the addon should be shippable now
1 parent e6c3810 commit 3c2f958

File tree

3 files changed

+28
-14
lines changed

3 files changed

+28
-14
lines changed

README.md

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
# angular-cli-ghpages
22

33
Angular CLI addon. Publish to any gh-pages branch on GitHub (or any other branch on any other remote).
4-
This is __NOT__ [IgorMinar/angular-cli-github-pages](https://github.com/IgorMinar/angular-cli-github-pages).
4+
This is __NOT__ [IgorMinar/angular-cli-github-pages](https://github.com/IgorMinar/angular-cli-github-pages). Brought to you by the [angular2buch.de](https://angular2buch.de/) team!
55

66
## WHY?
77

8-
[IgorMinar/angular-cli-github-pages](https://github.com/IgorMinar/angular-cli-github-pages) is fixed to the `gh-pages` branch of the same repository. In my oponion it is also trying to do too much.
9-
In contrast to this, the [Angular2Buch/angular-cli-ghpages](https://github.com/Angular2Buch/angular-cli-ghpages) addon is much more simple. It pushes to any branch on any repository, by utilizing [tschaub/gh-pages](https://github.com/tschaub/gh-pages). Nothing more.
10-
This addon works great on Travis-CI.
8+
[IgorMinar/angular-cli-github-pages](https://github.com/IgorMinar/angular-cli-github-pages) is limited to the `gh-pages` branch of the same repository.
9+
10+
In contrast to this, the [Angular2Buch/angular-cli-ghpages](https://github.com/Angular2Buch/angular-cli-ghpages) addon is able to push to any branch on any repository. It's build on top of [tschaub/gh-pages](https://github.com/tschaub/gh-pages).
11+
12+
__This addon works great on [Travis-CI](https://travis-ci.org/).__
1113

1214
## Installation & Setup
1315

@@ -35,14 +37,6 @@ ng build
3537
ng ghpages [OPTIONS]
3638
```
3739

38-
The following command runs on our Travis-CI:
39-
40-
```sh
41-
ng build --environment=production
42-
ng ghpages --repo=https://TheBuildbot:[email protected]/Angular2Buch/book-monkey2-public.git --name="The Buildbot" [email protected]
43-
```
44-
45-
4640
## Options
4741

4842
#### <a id="repo">--repo</a>
@@ -84,9 +78,20 @@ If you are running the command in a repository without a `user.name` or `user.em
8478

8579
Suppress logging. With silent `true` log messages are suppressed and error messages are sanitized.
8680

87-
> This option should be used if the repository URL or other information passed to git commands is sensitive and should not be logged.
81+
> This option should be used if the repository URL or other information passed to git commands is sensitive and should not be logged. By default the silent mode is enabled to avoid sensitive data exposure.
82+
83+
84+
## Extra
85+
86+
For your convenience, the addon will recognize the [environment variable](https://docs.travis-ci.com/user/environment-variables/#Defining-Variables-in-Repository-Settings) `REPO_USER_AND_PASS` and will replace this pattern in the `--repo` string. Please __do NOT disable the silent mode__ if you have credentials in the repository URL!
8887

88+
In example, the following command runs [on our Travis-CI](https://travis-ci.org/Angular2Buch/book-monkey2):
8989

90+
```sh
91+
ng build --environment=production
92+
ng ghpages --repo=https://[email protected]/Angular2Buch/book-monkey2-public.git --name="The Buildbot" [email protected]
93+
```
94+
> REPO_USER_AND_PASS stores credentials in the format `username:password`. Special charcaters must be [percent-encoded](https://en.wikipedia.org/wiki/Percent-encoding).
9095
9196
## License
9297
Code released under the [MIT license](https://opensource.org/licenses/MIT).

deploy.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,15 @@ module.exports = {
6363
'Triggered by commit: https://github.com/' + process.env.TRAVIS_REPO_SLUG + '/commit/' + process.env.TRAVIS_COMMIT + '\n' +
6464
'Travis build: https://travis-ci.org/' + process.env.TRAVIS_REPO_SLUG + '/builds/' + process.env.TRAVIS_BUILD_ID;
6565
}
66+
67+
// for your convenience - here you can hack credentials into the repository URL
68+
if (process.env.REPO_USER_AND_PASS && options.repo) {
69+
options.repo = options.repo.replace('REPO_USER_AND_PASS', process.env.REPO_USER_AND_PASS);
70+
}
71+
72+
// always clean the cache directory.
73+
// avoids "Error: Remote url mismatch."
74+
ghpages.clean();
6675

6776
var access = publish = RSVP.denodeify(fs.access);
6877
var publish = RSVP.denodeify(ghpages.publish);

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
],
3434
"license": "MIT",
3535
"dependencies": {
36-
"gh-pages": "^0.3.1",
36+
"gh-pages": "^0.11.0",
3737
"rsvp": "^3.0.14"
3838
},
3939
"keywords": ["ember-addon", "angular2", "angular-cli", "git", "gh-pages", "ghpages"]

0 commit comments

Comments
 (0)