Skip to content

Commit

Permalink
Merge pull request #382 from olafurpg/git_deploy_branch
Browse files Browse the repository at this point in the history
Add CI deploy instructions for GitHub Actions
  • Loading branch information
olafurpg authored Sep 4, 2020
2 parents 8488bb7 + 251d4a7 commit 992cc2f
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 39 deletions.
15 changes: 15 additions & 0 deletions .github/workflows/mdoc.yml
Original file line number Diff line number Diff line change
@@ -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 }}
26 changes: 0 additions & 26 deletions .travis.yml

This file was deleted.

46 changes: 33 additions & 13 deletions docs/docusaurus.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand All @@ -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,
Expand Down

0 comments on commit 992cc2f

Please sign in to comment.