diff --git a/docs/docusaurus.md b/docs/docusaurus.md index 3cd00c307..a700760d3 100644 --- a/docs/docusaurus.md +++ b/docs/docusaurus.md @@ -62,9 +62,9 @@ several steps: http://static.javadoc.io/ The static website gets generated in the `website/build` directory. You can copy -these files over to any static HTTP server to host your website. A simple `sbt docs/clean` -will delete the previous folder since the `DocusaurusPlugin` will also bind it to the -standard SBT `clean` task. +these files over to any static HTTP server to host your website. A simple +`sbt docs/clean` will delete the previous folder since the `DocusaurusPlugin` +will also bind it to the standard SBT `clean` task. ## Publish to GitHub pages locally @@ -134,8 +134,8 @@ https://travis-ci.org/scalameta/mdoc/settings. Add the following values: -- `GITHUB_DEPLOY_KEY` or `DEPLOY_KEY`: the base64 encoded secret key. Note, the secret key is - the file without the `.pub` extension +- `GITHUB_DEPLOY_KEY` or `GIT_DEPLOY_KEY`: the base64 encoded secret key. Note, + the secret key is the file without the `.pub` extension ```sh # macOS cat myproject | base64 | pbcopy @@ -184,7 +184,9 @@ docs 😎 ## Include Scaladoc in site -You can configure a project to include Scaladocs in its site. Below is an example configuration that uses [sbt-unidoc](https://github.com/sbt/sbt-unidoc) to aggregate Scaladocs across multiple projects. +You can configure a project to include Scaladocs in its site. Below is an +example configuration that uses [sbt-unidoc](https://github.com/sbt/sbt-unidoc) +to aggregate Scaladocs across multiple projects. ```diff // build.sbt @@ -202,9 +204,13 @@ You can configure a project to include Scaladocs in its site. Below is an exampl .dependsOn(myproject1, myproject2) ``` -Make sure that you've added the [sbt-unidoc](https://github.com/sbt/sbt-unidoc#how-to-add-this-plugin) dependency to `project/plugins.sbt`. +Make sure that you've added the +[sbt-unidoc](https://github.com/sbt/sbt-unidoc#how-to-add-this-plugin) +dependency to `project/plugins.sbt`. -Now the `docs/docusaurusCreateSite` command will generate Scaladocs in the `website/static/api` directory, which you'll probably want to add to your `.gitignore`: +Now the `docs/docusaurusCreateSite` command will generate Scaladocs in the +`website/static/api` directory, which you'll probably want to add to your +`.gitignore`: ```diff // .gitignore @@ -217,7 +223,8 @@ Now the `docs/docusaurusCreateSite` command will generate Scaladocs in the `webs + website/static/api ``` -You'll need to tweak your `siteConfig.js` file to make Docusaurus play nicely with Scaladoc's CSS. You may want to add a header link to your API docs too: +You'll need to tweak your `siteConfig.js` file to make Docusaurus play nicely +with Scaladoc's CSS. You may want to add a header link to your API docs too: ```diff // website/siteConfig.js diff --git a/mdoc-sbt/src/main/scala/mdoc/DocusaurusPlugin.scala b/mdoc-sbt/src/main/scala/mdoc/DocusaurusPlugin.scala index 7a21554ae..6358d12b6 100644 --- a/mdoc-sbt/src/main/scala/mdoc/DocusaurusPlugin.scala +++ b/mdoc-sbt/src/main/scala/mdoc/DocusaurusPlugin.scala @@ -54,9 +54,8 @@ object DocusaurusPlugin extends AutoPlugin { """|#!/usr/bin/env bash | |set -eu - | + |DEPLOY_KEY=${GIT_DEPLOY_KEY:-$GITHUB_DEPLOY_KEY} |set-up-ssh() { - | KEY=$1 | echo "Setting up ssh..." | mkdir -p $HOME/.ssh | ssh-keyscan -t rsa github.com >> ~/.ssh/known_hosts @@ -64,18 +63,17 @@ object DocusaurusPlugin extends AutoPlugin { | git config --global user.email "${MDOC_EMAIL:-mdoc@docusaurus}" | git config --global push.default simple | DEPLOY_KEY_FILE=$HOME/.ssh/id_rsa - | echo "$KEY" | base64 --decode > ${DEPLOY_KEY_FILE} + | echo "$DEPLOY_KEY" | base64 --decode > ${DEPLOY_KEY_FILE} | chmod 600 ${DEPLOY_KEY_FILE} | eval "$(ssh-agent -s)" | ssh-add ${DEPLOY_KEY_FILE} |} | - | if [[ -n "${GITHUB_DEPLOY_KEY:-}" ]]; then - | set-up-ssh ${GITHUB_DEPLOY_KEY} - | elif [[ -n "${DEPLOY_KEY:-}" ]]; then - | echo "Using fallback env var DEPLOY_KEY." - | set-up-ssh ${DEPLOY_KEY} - | fi + |if [[ -n "${DEPLOY_KEY:-}" ]]; then + | set-up-ssh + |else + | echo "Can't setup SSH. To fix this problem, set the GIT_DEPLOY_KEY environment variable." + |fi | |yarn install |USE_SSH=true yarn publish-gh-pages