mirror of
https://github.com/facebook/docusaurus.git
synced 2025-06-04 11:52:39 +02:00
docs(v2): misc update
This commit is contained in:
parent
e8f50af8f0
commit
0dc0c35ec8
2 changed files with 43 additions and 44 deletions
|
@ -87,12 +87,11 @@ cmd /C "set "GIT_USER=<GITHUB_USERNAME>" && yarn deploy"
|
||||||
|
|
||||||
[GitHub Actions](https://help.github.com/en/actions) allow you to automate, customize, and execute your software development workflows right in your repository.
|
[GitHub Actions](https://help.github.com/en/actions) allow you to automate, customize, and execute your software development workflows right in your repository.
|
||||||
|
|
||||||
This workflow assumes your documentation resided in `documentation` branch of your repository and your [publishing source](https://help.github.com/en/github/working-with-github-pages/configuring-a-publishing-source-for-your-github-pages-site)
|
This workflow assumes your documentation resided in `documentation` branch of your repository and your [publishing source](https://help.github.com/en/github/working-with-github-pages/configuring-a-publishing-source-for-your-github-pages-site) is configured for `gh-pages` branch.
|
||||||
is configured for `gh-pages` branch.
|
|
||||||
|
|
||||||
1. Generate a new [SSH key](https://help.github.com/en/github/authenticating-to-github/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent).
|
1. Generate a new [SSH key](https://help.github.com/en/github/authenticating-to-github/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent).
|
||||||
1. By default, your public key should have been created in `~/.ssh/id_rsa.pub` or use the name you've provided in the previous step to add your key to [GitHub deploy keys](https://developer.github.com/v3/guides/managing-deploy-keys/).
|
1. By default, your public key should have been created in `~/.ssh/id_rsa.pub` or use the name you've provided in the previous step to add your key to [GitHub deploy keys](https://developer.github.com/v3/guides/managing-deploy-keys/).
|
||||||
1. Copy key to clipboard with `xclip -sel clip < ~/.ssh/id_rsa.pub` and paste it as a [deploy key](https://developer.github.com/v3/guides/managing-deploy-keys/#deploy-keys ) in your repository. Copy file content if the command line doesn't work for you. Check the box for `Allow write access` before saving your deployment key.
|
1. Copy key to clipboard with `xclip -sel clip < ~/.ssh/id_rsa.pub` and paste it as a [deploy key](https://developer.github.com/v3/guides/managing-deploy-keys/#deploy-keys) in your repository. Copy file content if the command line doesn't work for you. Check the box for `Allow write access` before saving your deployment key.
|
||||||
1. You'll need your private key as a [GitHub secret](https://help.github.com/en/actions/configuring-and-managing-workflows/creating-and-storing-encrypted-secrets) to allow Docusaurus to run the deployment for you.
|
1. You'll need your private key as a [GitHub secret](https://help.github.com/en/actions/configuring-and-managing-workflows/creating-and-storing-encrypted-secrets) to allow Docusaurus to run the deployment for you.
|
||||||
1. Copy your private key with `xclip -sel clip < ~/.ssh/id_rsa` and paste a GitHub secret with name `GH_PAGES_DEPLOY`. Copy file content if the command line doesn't work for you. Save your secret.
|
1. Copy your private key with `xclip -sel clip < ~/.ssh/id_rsa` and paste a GitHub secret with name `GH_PAGES_DEPLOY`. Copy file content if the command line doesn't work for you. Save your secret.
|
||||||
1. Create you [documentation workflow file](https://help.github.com/en/actions/configuring-and-managing-workflows/configuring-a-workflow#creating-a-workflow-file) in `.github/workflows/`. In this example it's `documentation.yml`.
|
1. Create you [documentation workflow file](https://help.github.com/en/actions/configuring-and-managing-workflows/configuring-a-workflow#creating-a-workflow-file) in `.github/workflows/`. In this example it's `documentation.yml`.
|
||||||
|
@ -107,47 +106,47 @@ on:
|
||||||
branches: [documentation]
|
branches: [documentation]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
checks:
|
checks:
|
||||||
if: github.event_name != 'push'
|
if: github.event_name != 'push'
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v1
|
- uses: actions/checkout@v1
|
||||||
- uses: actions/setup-node@v1
|
- uses: actions/setup-node@v1
|
||||||
with:
|
with:
|
||||||
node-version: '12.x'
|
node-version: '12.x'
|
||||||
run: |
|
run: |
|
||||||
|
npm ci
|
||||||
|
npm run build
|
||||||
|
gh-release:
|
||||||
|
if: github.event_name != 'pull_request'
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v1
|
||||||
|
- uses: actions/setup-node@v1
|
||||||
|
with:
|
||||||
|
node-version: '12.x'
|
||||||
|
- name: Add key to allow access to repository
|
||||||
|
env:
|
||||||
|
SSH_AUTH_SOCK: /tmp/ssh_agent.sock
|
||||||
|
run: |
|
||||||
|
mkdir -p ~/.ssh
|
||||||
|
ssh-keyscan github.com >> ~/.ssh/known_hosts
|
||||||
|
echo "${{ secrets.GH_PAGES_DEPLOY }}" > ~/.ssh/id_rsa
|
||||||
|
chmod 600 ~/.ssh/id_rsa
|
||||||
|
cat <<EOT >> ~/.ssh/config
|
||||||
|
Host github.com
|
||||||
|
HostName github.com
|
||||||
|
IdentityFile ~/.ssh/id_rsa
|
||||||
|
EOT
|
||||||
|
- name: Release to GitHub Pages
|
||||||
|
env:
|
||||||
|
USE_SSH: true
|
||||||
|
GIT_USER: git
|
||||||
|
run: |
|
||||||
|
git config --global user.email "actions@gihub.com"
|
||||||
|
git config --global user.name "gh-actions"
|
||||||
npm ci
|
npm ci
|
||||||
npm run build
|
npx docusaurus deploy
|
||||||
gh-release:
|
|
||||||
if: github.event_name != 'pull_request'
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v1
|
|
||||||
- uses: actions/setup-node@v1
|
|
||||||
with:
|
|
||||||
node-version: '12.x'
|
|
||||||
- name: Add key to allow access to repository
|
|
||||||
env:
|
|
||||||
SSH_AUTH_SOCK: /tmp/ssh_agent.sock
|
|
||||||
run: |
|
|
||||||
mkdir -p ~/.ssh
|
|
||||||
ssh-keyscan github.com >> ~/.ssh/known_hosts
|
|
||||||
echo "${{ secrets.GH_PAGES_DEPLOY }}" > ~/.ssh/id_rsa
|
|
||||||
chmod 600 ~/.ssh/id_rsa
|
|
||||||
cat <<EOT >> ~/.ssh/config
|
|
||||||
Host github.com
|
|
||||||
HostName github.com
|
|
||||||
IdentityFile ~/.ssh/id_rsa
|
|
||||||
EOT
|
|
||||||
- name: Release to GitHub Pages
|
|
||||||
env:
|
|
||||||
USE_SSH: true
|
|
||||||
GIT_USER: git
|
|
||||||
run: |
|
|
||||||
git config --global user.email "actions@gihub.com"
|
|
||||||
git config --global user.name "gh-actions"
|
|
||||||
npm ci
|
|
||||||
npx docusaurus deploy
|
|
||||||
```
|
```
|
||||||
|
|
||||||
1. Now when a new pull request arrives towards your repository in branch `documentation` it will automatically ensure that Docusaurus build is successful.
|
1. Now when a new pull request arrives towards your repository in branch `documentation` it will automatically ensure that Docusaurus build is successful.
|
||||||
|
|
|
@ -29,7 +29,7 @@ You can also import SVG images, which will be transformed into React components.
|
||||||
```jsx title="MyComponent.js"
|
```jsx title="MyComponent.js"
|
||||||
import DocusaurusLogoWithKeytar from '@site/static/img/docusaurus_keytar.svg';
|
import DocusaurusLogoWithKeytar from '@site/static/img/docusaurus_keytar.svg';
|
||||||
|
|
||||||
<DocusaurusLogoWithKeytar title="test" className="blah" />
|
<DocusaurusLogoWithKeytar title="Docusaurus Logo" className="logo" />;
|
||||||
```
|
```
|
||||||
|
|
||||||
### Markdown example
|
### Markdown example
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue