diff --git a/.github/workflows/mdoc.yml b/.github/workflows/mdoc.yml new file mode 100644 index 000000000..ad7594dff --- /dev/null +++ b/.github/workflows/mdoc.yml @@ -0,0 +1,15 @@ +name: Website +on: + push: + branches: [master] + tags: ["*"] +jobs: + publish: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v1 + - uses: olafurpg/setup-scala@v7 + - uses: olafurpg/setup-gpg@v2 + - run: sbt docs/docusaurusPublishGhpages + env: + GIT_DEPLOY_KEY: ${{ secrets.GIT_DEPLOY_KEY }} diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 6277c2804..000000000 --- a/.travis.yml +++ /dev/null @@ -1,26 +0,0 @@ -language: scala -jdk: - - openjdk8 - -stages: - - name: test - - name: release - if: (branch = master AND type = push) OR (tag IS present) - -jobs: - include: - - stage: release - script: sbt docs/docusaurusPublishGhpages - -cache: - directories: - - $HOME/.sbt - - $HOME/.ivy2/cache - - $HOME/.coursier - -before_cache: - - du -h -d 1 $HOME/.ivy2/cache - - du -h -d 2 $HOME/.sbt/ - - find $HOME/.sbt -name "*.lock" -type f -delete - - find $HOME/.ivy2/cache -name "ivydata-*.properties" -type f -delete - - rm -rf $HOME/.ivy2/local diff --git a/docs/docusaurus.md b/docs/docusaurus.md index a700760d3..975a0ad4b 100644 --- a/docs/docusaurus.md +++ b/docs/docusaurus.md @@ -84,13 +84,14 @@ pages. This task run several steps: ## Publish to GitHub pages from CI -You can configure your Travis CI server to publish docs after merge into master. -The [Docusaurus docs](https://docusaurus.io/docs/en/publishing#using-travis-cih) -already have excellent instructions for how to set this up. If those -instructions work for you, then that's great! No need to read this section here. -However, you prefer to use "deploy keys" over "personal access tokens because -deploy keys are limited to individual repositories instead of per-account. If -this sounds interesting, read ahead. +You can configure GitHub Actions or Travis CI server to publish docs after merge +into master. The +[Docusaurus docs](https://docusaurus.io/docs/en/publishing#using-travis-cih) +already have instructions for how to set this up. If those instructions work for +you, then that's great! No need to read this section here. However, you prefer +to use "deploy keys" over "personal access tokens because deploy keys are +limited to individual repositories instead of per-account. If this sounds +interesting, read ahead. ### Deploy key @@ -125,17 +126,20 @@ https://github.com/scalameta/mdoc/settings/keys. Press "Add deploy key". Your screen should look like this -![Add GitHub deploy key](assets/deploy_key.png) +![Add GitHub deploy key](https://i.imgur.com/hm3MpUK.png) ### Environment variables -Next open the Travis CI settings panel for your project: -https://travis-ci.org/scalameta/mdoc/settings. +Next open the secrets settings for your CI provider. The URL for the mdoc repo +looks like this: + +- GitHub Actions: https://github.com/scalameta/mdoc/settings/secrets +- Travis CI: https://travis-ci.org/scalameta/mdoc/settings Add the following values: -- `GITHUB_DEPLOY_KEY` or `GIT_DEPLOY_KEY`: the base64 encoded secret key. Note, - the secret key is the file without the `.pub` extension +- `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 @@ -145,7 +149,23 @@ Add the following values: cat myproject | base64 | xclip ``` -### `.travis.yml` +### GitHub Actions + +> Skip this part if you are not using GitHub Actions. + +Next, create a new file at `.github/workflows/mdoc.yml` to trigger +`docs/docusaurusPublishGhpages` on successful merge into master and on tag push. + +```scala mdoc:file:.github/workflows/mdoc.yml + +``` + +Commit your changes, push to master and you're all set! Merge a PR to your +project and watch GitHub Actions release the docs 😎 + +### Travis CI + +> Skip this part if you are not using Travis CI Next, update .travis.yml to trigger `docs/docusaurusPublishGhpages` on successful merge into master and on tag push. There are many ways to do this,