From cbfd75a821f7d2113656e5aadc3b98ecd0b2251a Mon Sep 17 00:00:00 2001 From: A Ho Date: Thu, 5 Nov 2020 21:43:52 +0000 Subject: [PATCH 1/3] Update CI section in guide for travis dpl-v2 This is so that the instructions work when deploying the book to GitHub pages via the gh-pages branch. --- guide/src/continuous-integration.md | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/guide/src/continuous-integration.md b/guide/src/continuous-integration.md index 50a92af0..32e0087c 100644 --- a/guide/src/continuous-integration.md +++ b/guide/src/continuous-integration.md @@ -12,7 +12,8 @@ run. ```yaml language: rust -sudo: false +os: linux +dist: xenial cache: - cargo @@ -39,18 +40,24 @@ permissions (or "repo" for private repositories). Go to your repository's Travis CI settings page and add an environment variable named `GITHUB_TOKEN` that is marked secure and *not* shown in the logs. +Whilst still in your repository's settings page, navigate to Options and change the +Source on GitHub pages to `gh-pages`. + Then, append this snippet to your `.travis.yml` and update the path to the `book` directory: ```yaml deploy: provider: pages - skip-cleanup: true + strategy: git + edge: true + cleanup: false github-token: $GITHUB_TOKEN local-dir: path/to/mybook/book keep-history: false on: branch: master + target_branch: gh-pages ``` That's it! From e310dfc605280b6dedfa2be9c50cbb774026f05b Mon Sep 17 00:00:00 2001 From: A Ho Date: Thu, 5 Nov 2020 22:28:54 +0000 Subject: [PATCH 2/3] Add avisionh to contributors This is for contributing to the travis deployments chapter. --- guide/src/misc/contributors.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/guide/src/misc/contributors.md b/guide/src/misc/contributors.md index 8d1a30ff..0be8f55c 100644 --- a/guide/src/misc/contributors.md +++ b/guide/src/misc/contributors.md @@ -16,5 +16,6 @@ shout-out to them! - [Phaiax](https://github.com/Phaiax) - Matt Ickstadt ([mattico](https://github.com/mattico)) - Weihang Lo ([@weihanglo](https://github.com/weihanglo)) +- Avision Ho ([@avisionh](https://github.com/avisionh)) -If you feel you're missing from this list, feel free to add yourself in a PR. \ No newline at end of file +If you feel you're missing from this list, feel free to add yourself in a PR. From 75d0f1efd48e01114e63260defe1f7e14bd937b8 Mon Sep 17 00:00:00 2001 From: A Ho Date: Fri, 13 Nov 2020 09:40:33 +0000 Subject: [PATCH 3/3] Suggest dplyv2 changes to .travis.yml as a note This is following @ehuss' comment to not recommend something currently in beta release. --- guide/src/continuous-integration.md | 38 ++++++++++++++++++++++++++--- 1 file changed, 34 insertions(+), 4 deletions(-) diff --git a/guide/src/continuous-integration.md b/guide/src/continuous-integration.md index 32e0087c..e9dacc6e 100644 --- a/guide/src/continuous-integration.md +++ b/guide/src/continuous-integration.md @@ -12,8 +12,7 @@ run. ```yaml language: rust -os: linux -dist: xenial +sudo: false cache: - cargo @@ -47,6 +46,39 @@ Then, append this snippet to your `.travis.yml` and update the path to the `book` directory: ```yaml +deploy: + provider: pages + skip-cleanup: true + github-token: $GITHUB_TOKEN + local-dir: path/to/mybook/book + keep-history: false + on: + branch: master +``` + +That's it! + +Note: Travis has a new [dplv2](https://blog.travis-ci.com/2019-08-27-deployment-tooling-dpl-v2-preview-release) configuration that is currently in beta. To use this new format, update your `.travis.yml` file to: + +```yaml +language: rust +os: linux +dist: xenial + +cache: + - cargo + +rust: + - stable + +before_script: + - (test -x $HOME/.cargo/bin/cargo-install-update || cargo install cargo-update) + - (test -x $HOME/.cargo/bin/mdbook || cargo install --vers "^0.3" mdbook) + - cargo install-update -a + +script: + - mdbook build path/to/mybook && mdbook test path/to/mybook + deploy: provider: pages strategy: git @@ -60,8 +92,6 @@ deploy: target_branch: gh-pages ``` -That's it! - ### Deploying to GitHub Pages manually If your CI doesn't support GitHub pages, or you're deploying somewhere else