{"action":"created","issue":{"url":"https://api.github.com/repos/apreshill/stat545-reboot/issues/1","repository_url":"https://api.github.com/repos/apreshill/stat545-reboot","labels_url":"https://api.github.com/repos/apreshill/stat545-reboot/issues/1/labels{/name}","comments_url":"https://api.github.com/repos/apreshill/stat545-reboot/issues/1/comments","events_url":"https://api.github.com/repos/apreshill/stat545-reboot/issues/1/events","html_url":"https://github.com/apreshill/stat545-reboot/issues/1","id":376572016,"node_id":"MDU6SXNzdWUzNzY1NzIwMTY=","number":1,"title":"Travis CI + Netlify workflow","user":{"login":"apreshill","id":12160301,"node_id":"MDQ6VXNlcjEyMTYwMzAx","avatar_url":"https://avatars3.githubusercontent.com/u/12160301?v=4","gravatar_id":"","url":"https://api.github.com/users/apreshill","html_url":"https://github.com/apreshill","followers_url":"https://api.github.com/users/apreshill/followers","following_url":"https://api.github.com/users/apreshill/following{/other_user}","gists_url":"https://api.github.com/users/apreshill/gists{/gist_id}","starred_url":"https://api.github.com/users/apreshill/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apreshill/subscriptions","organizations_url":"https://api.github.com/users/apreshill/orgs","repos_url":"https://api.github.com/users/apreshill/repos","events_url":"https://api.github.com/users/apreshill/events{/privacy}","received_events_url":"https://api.github.com/users/apreshill/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2018-11-01T21:09:46Z","updated_at":"2018-12-09T04:30:52Z","closed_at":null,"author_association":"OWNER","body":"Still not entirely sure what worked and what did not, but these are my breadcrumbs for next time...\r\n\r\n1. Make a new Netlify site from GitHub repo via browser\r\n\r\n2. If first time doing this at all, locally install Netlify CLI via terminal\r\n\r\n```\r\nbrew install node # install nodejs first via homebrew\r\nnpm install netlify-cli -g # then install cli for netlify\r\nnetlify login # via browser pop-up\r\n```\r\n\r\n3. For each new site, do:\r\n\r\n```\r\nnetlify link\r\n```\r\n\r\nFrom Jenny's notes: \"This produced `.netlify/state.json`, which holds the (non-secret) site id. Apparently this can also be provided via a travis env var named `NETLIFY_SITE_ID` (ok to reveal in the log).\"\r\n\r\nWhat did not work was: (a) setting the netlify site link with a text file called [`.netlify`](https://github.com/dgrtwo/tidy-text-mining/blob/master/.netlify); or (b) using the `\"path\":\"_book\"` in that file either (conclude that you should use the `.travis.yml` below to set the `--dir _book` instead).\r\n\r\n4. [Obtain a Token in the Netlify UI](https://www.netlify.com/docs/cli/#authentication)\r\n\r\n5. In Travis:\r\n    - enable continuous integration for your book’s GitHub repo on Travis\r\n    - save the Netlify token from step 4 as a [`NETLIFY_AUTH_TOKEN`](https://www.netlify.com/docs/cli/#authentication) environment variable.\r\n\r\n6. Following [Sean Kross' instructions for adding Travis to a bookdown](http://seankross.com/2016/11/17/How-to-Start-a-Bookdown-Book.html)\r\n    - add `.Rbuildignore`\r\n    - add `DESCRIPTION`\r\n    - add `.travis.yml`:\r\n\r\n```\r\n# R for travis: see documentation at https://docs.travis-ci.com/user/languages/r\r\n\r\nlanguage: R\r\nsudo: false\r\ncache:\r\n  packages: true\r\n  directories:\r\n  - _bookdown_files\r\n  - $HOME/.npm\r\n\r\nbefore_install:\r\n- npm install netlify-cli -g\r\n\r\nscript:\r\n- Rscript -e 'bookdown::render_book(\"index.Rmd\")'\r\n\r\nafter_success:\r\n- netlify deploy --prod --dir _book\r\n```\r\n\r\n7. Modify `.gitignore` to include: \r\n    - `_book` (unless you had changed the bookdown default `output_dir` to [something else](https://bookdown.org/yihui/bookdown/configuration.html))\r\n    - `_bookdown_files`\r\n\r\n8. add, commit, and push these files.\r\n\r\nLots of help from @jennybc's notes:\r\n\r\njennybc/whattheyforgot#25\r\n\r\nAnd from here:\r\n\r\nrstudio/bookdown#459\r\n\r\nAnd here:\r\ndgrtwo/tidy-text-mining#42"},"comment":{"url":"https://api.github.com/repos/apreshill/stat545-reboot/issues/comments/445510383","html_url":"https://github.com/apreshill/stat545-reboot/issues/1#issuecomment-445510383","issue_url":"https://api.github.com/repos/apreshill/stat545-reboot/issues/1","id":445510383,"node_id":"MDEyOklzc3VlQ29tbWVudDQ0NTUxMDM4Mw==","user":{"login":"apreshill","id":12160301,"node_id":"MDQ6VXNlcjEyMTYwMzAx","avatar_url":"https://avatars3.githubusercontent.com/u/12160301?v=4","gravatar_id":"","url":"https://api.github.com/users/apreshill","html_url":"https://github.com/apreshill","followers_url":"https://api.github.com/users/apreshill/followers","following_url":"https://api.github.com/users/apreshill/following{/other_user}","gists_url":"https://api.github.com/users/apreshill/gists{/gist_id}","starred_url":"https://api.github.com/users/apreshill/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apreshill/subscriptions","organizations_url":"https://api.github.com/users/apreshill/orgs","repos_url":"https://api.github.com/users/apreshill/repos","events_url":"https://api.github.com/users/apreshill/events{/privacy}","received_events_url":"https://api.github.com/users/apreshill/received_events","type":"User","site_admin":false},"created_at":"2018-12-09T04:30:52Z","updated_at":"2018-12-09T04:30:52Z","author_association":"OWNER","body":"Huzzah this worked!\r\n\r\nnew `_travis.yml`\r\n\r\n```\r\n# R for travis: see documentation at https://docs.travis-ci.com/user/languages/r\r\n\r\nlanguage: R\r\nsudo: false\r\ncache:\r\n  packages: true\r\n  directories:\r\n  - _bookdown_files\r\n\r\nscript:\r\n- Rscript -e 'bookdown::render_book(\"index.Rmd\", \"bookdown::gitbook\")'\r\n\r\ndeploy:\r\n  provider: pages\r\n  local_dir: _book\r\n  skip_cleanup: true\r\n  keep-history: true\r\n  github_token: $stat545_GITHUB_PAT\r\n  target_branch: gh-pages\r\n  on:\r\nall_branches: true\r\n```\r\n\r\n<img width=\"913\" alt=\"screen shot 2018-12-08 at 8 30 02 pm\" src=\"https://user-images.githubusercontent.com/12160301/49693451-12f35280-fb28-11e8-8acd-2be1cda567b3.png\">\r\n"}}
{"actor":{"display_login":"apreshill"}}