Docs: Add Search (#2228)
* add search and update depedencies * refactor documentation workflow to follow best github action best practices
This commit is contained in:
parent
854401ec00
commit
225dc92adf
95
.github/workflows/docs.yaml
vendored
95
.github/workflows/docs.yaml
vendored
@ -9,63 +9,64 @@ on:
|
|||||||
paths: ['docs/**']
|
paths: ['docs/**']
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
checks:
|
pull-request-check:
|
||||||
if: github.event_name != 'push'
|
if: github.event_name == 'pull_request'
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
- uses: actions/setup-node@v1
|
|
||||||
|
- uses: actions/setup-node@v3
|
||||||
with:
|
with:
|
||||||
node-version: '17.x'
|
node-version: 18
|
||||||
|
|
||||||
- name: Test Build
|
- name: Test Build
|
||||||
working-directory: ./docs
|
working-directory: ./docs
|
||||||
env:
|
|
||||||
NODE_OPTIONS: --openssl-legacy-provider
|
|
||||||
run: |
|
run: |
|
||||||
if [ -e yarn.lock ]; then
|
|
||||||
yarn install --frozen-lockfile
|
|
||||||
elif [ -e package-lock.json ]; then
|
|
||||||
npm ci
|
npm ci
|
||||||
else
|
|
||||||
npm i
|
|
||||||
fi
|
|
||||||
npm run build
|
npm run build
|
||||||
gh-release:
|
|
||||||
if: github.event_name != 'pull_request'
|
gh-pages-release:
|
||||||
|
if: github.event_name == 'push'
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
- uses: actions/setup-node@v1
|
|
||||||
with:
|
with:
|
||||||
node-version: '17.x'
|
path: master
|
||||||
- name: Add key to allow access to repository
|
|
||||||
env:
|
- uses: actions/checkout@v4
|
||||||
SSH_AUTH_SOCK: /tmp/ssh_agent.sock
|
with:
|
||||||
NODE_OPTIONS: --openssl-legacy-provider
|
ref: gh-pages
|
||||||
|
path: gh-pages
|
||||||
|
|
||||||
|
- uses: actions/setup-node@v3
|
||||||
|
with:
|
||||||
|
node-version: 18
|
||||||
|
|
||||||
|
- name: Build docusaurus
|
||||||
|
working-directory: master/docs
|
||||||
|
id: build
|
||||||
run: |
|
run: |
|
||||||
mkdir -p ~/.ssh
|
echo "sha=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
|
||||||
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
|
|
||||||
working-directory: ./docs
|
|
||||||
env:
|
|
||||||
USE_SSH: true
|
|
||||||
GIT_USER: git
|
|
||||||
NODE_OPTIONS: --openssl-legacy-provider
|
|
||||||
run: |
|
|
||||||
git config --global user.email "actions@gihub.com"
|
|
||||||
git config --global user.name "gh-actions"
|
|
||||||
if [ -e yarn.lock ]; then
|
|
||||||
yarn install --frozen-lockfile
|
|
||||||
elif [ -e package-lock.json ]; then
|
|
||||||
npm ci
|
npm ci
|
||||||
else
|
npm run build
|
||||||
npm i
|
|
||||||
fi
|
- name: Release to github pages
|
||||||
npx docusaurus deploy
|
env:
|
||||||
|
GIT_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
working-directory: gh-pages
|
||||||
|
run: |
|
||||||
|
git config --local user.name "github-actions[bot]"
|
||||||
|
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
||||||
|
|
||||||
|
# Remove all files except .git
|
||||||
|
git rm -r *
|
||||||
|
|
||||||
|
# Copy the build files from master/docs/build to gh-pages
|
||||||
|
cp -r ../master/docs/build/* .
|
||||||
|
|
||||||
|
# Commit and push
|
||||||
|
git add .
|
||||||
|
git commit -m "Update documentation based on ${{ steps.build.outputs.sha }}"
|
||||||
|
git push origin gh-pages
|
||||||
|
@ -54,4 +54,13 @@ module.exports = {
|
|||||||
},
|
},
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
|
themes: [
|
||||||
|
[
|
||||||
|
require.resolve("@easyops-cn/docusaurus-search-local"),
|
||||||
|
/** @type {import("@easyops-cn/docusaurus-search-local").PluginOptions} */
|
||||||
|
({
|
||||||
|
hashed: true,
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
],
|
||||||
};
|
};
|
||||||
|
14067
docs/package-lock.json
generated
14067
docs/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -1,5 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "docusaurus",
|
"name": "docusaurus",
|
||||||
|
|
||||||
"version": "0.0.0",
|
"version": "0.0.0",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
@ -13,6 +14,7 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@docusaurus/core": "^2.0.0-beta.15",
|
"@docusaurus/core": "^2.0.0-beta.15",
|
||||||
"@docusaurus/preset-classic": "^2.0.0-beta.15",
|
"@docusaurus/preset-classic": "^2.0.0-beta.15",
|
||||||
|
"@easyops-cn/docusaurus-search-local": "^0.29.0",
|
||||||
"@mdx-js/react": "^1.6.22",
|
"@mdx-js/react": "^1.6.22",
|
||||||
"clsx": "^1.1.1",
|
"clsx": "^1.1.1",
|
||||||
"react": "^16.14.0",
|
"react": "^16.14.0",
|
||||||
|
Loading…
Reference in New Issue
Block a user