Skip to content

Commit

Permalink
Deploy user docs only from main MarkBind repository (#817)
Browse files Browse the repository at this point in the history
Our Travis CI configuration will attempt to deploy our user docs from
any repository, including forks. This can lead to accidental overwriting
of the user docs from developer forks if they have write access to the
user docs repository.

Let's add a `on` condition to our Travis CI configuration to specify
that deployment of the user docs should only be done when run from the
main MarkBind repository.
  • Loading branch information
yamgent authored Apr 5, 2019
2 parents 7c8e391 + f46b154 commit c3d26e0
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ deploy:
script: cd docs && ../index.js build && ../index.js deploy --travis
skip_cleanup: true
on:
repo: MarkBind/markbind
tags: true
condition: $TRAVIS_TAG =~ ^v[0-9]+\.[0-9]+\.[0-9]+
cache:
Expand Down
18 changes: 15 additions & 3 deletions docs/userGuide/deployingTheSite.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,9 @@ Since May 2018, Travis CI has been [undergoing migration to `travis-ci.com`](htt
1. Once the build succeeds, your MarkBind site should be online at `http://<username|org>.github.io/<repo>` e.g., http://se-edu.github.io/se-book. Travis CI will automatically build and deploy changes to your site as you push new changes to the repository after a few seconds.<br>
%%{{ icon_info }} You might have to go to the `Settings` of your repo and configure it to publish GitHub Pages from the `gh-pages` branch as MarkBind deploys to that branch by default.%%

<box>
##### Configuring Travis CI to use a specific MarkBind version

{{ icon_info }} Note that when Travis CI is set up as explained above, it will use the latest version of MarkBind which may be a later version than the one you use locally.
When Travis CI is set up as explained above, it will use the latest version of MarkBind which may be a later version than the one you use locally.
* If you want Travis CI to use a specific version of MarkBind (eg. `v1.6.3`), change the `install` step in the `.travis.yml` given above to:
```yaml
install:
Expand All @@ -121,7 +121,19 @@ Since May 2018, Travis CI has been [undergoing migration to `travis-ci.com`](htt
install:
- npm i -g markbind-cli@^1.63
```
</box>
##### Configuring Travis CI to only deploy from a specific repository

When Travis CI is set up as explained above, Travis CI will attempt to deploy the site from any repository it is in, including forks. If you want Travis CI to only deploy from a specific repository (eg. only from your main site repository), you can set a [`deploy` phase with an `on` condition](https://docs.travis-ci.com/user/deployment#conditional-releases-with-on).

For example, if you only want Travis CI to deploy the site when it is run from the `se-edu/se-book` repository, the folllowing `deploy` phase with the `on` condition should be added to `.travis.yml`:

```yaml
deploy:
on:
repo: se-edu/se-book
```

The `repo` value can be changed to your specific repository as desired.

<hr>

Expand Down

0 comments on commit c3d26e0

Please sign in to comment.