From eb7f00c324a7a6e41a3fef089a7976998af527c1 Mon Sep 17 00:00:00 2001 From: Tan Zhen Yong Date: Fri, 8 Mar 2019 23:58:42 +0800 Subject: [PATCH 1/2] Deploy user docs only from main MarkBind repo 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. --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 664bfd40be..aa49365080 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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: From f46b1549b37addf0264ed96288222d97ae7cac23 Mon Sep 17 00:00:00 2001 From: Tan Zhen Yong Date: Fri, 5 Apr 2019 13:32:35 +0800 Subject: [PATCH 2/2] Docs: add steps for deploying from specific repo Restricting Travis CI to only deploy a MarkBind site from a main project repository should be quite a common use case for projects using MarkBind. Let's document how to restrict Travis CI deployment to a specific repository in our user documentation. --- docs/userGuide/deployingTheSite.md | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/docs/userGuide/deployingTheSite.md b/docs/userGuide/deployingTheSite.md index 1f7edfbea7..25332825d5 100644 --- a/docs/userGuide/deployingTheSite.md +++ b/docs/userGuide/deployingTheSite.md @@ -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://.github.io/` 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.
%%{{ 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.%% - +##### 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: @@ -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 ``` - +##### 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.