Skip to content

Commit

Permalink
Change website to vuepress hope theme
Browse files Browse the repository at this point in the history
  • Loading branch information
mario4tier committed Feb 14, 2024
1 parent efda2c7 commit 06cbe60
Show file tree
Hide file tree
Showing 90 changed files with 6,686 additions and 393 deletions.
60 changes: 38 additions & 22 deletions .github/actions/diffs/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,33 +2,49 @@ name: Detect Changes
description: Defines variables indicating the parts of the code that changed
outputs:
isDoc:
description: True when changes happened to some documentation
description: True when changes related to documentation
value: "${{ steps.diff.outputs.isDoc }}"
isRust:
description: True when changes happened to the Rust code
description: True when changes related to Rust
value: "${{ steps.diff.outputs.isRust }}"
isMove:
description: True when changes happened to the Move code
description: True when changes related to Move
value: "${{ steps.diff.outputs.isMove }}"

isScript:
description: True when changes related suibase scripts
value: "${{ steps.diff.outputs.isScript }}"
isDocHelperAPI:
description: True when changes to Helper API (docs)
value: "${{ steps.diff.outputs.isDoc }}"

runs:
using: composite
steps:
- uses: actions/checkout@v3
- name: Detect Changes
uses: dorny/[email protected]
id: diff
with:
filters: |
isRust:
- 'crates/**'
- '.github/workflows/rust.yml'
isDoc:
- 'docs/**'
- 'mkdocs.yml'
- '*.md'
- '.github/workflows/docs.yml'
isMove:
- 'move/sources/**'
- 'Cargo.toml'
- 'Cargo.lock'
- uses: actions/checkout@v3
- name: Detect Changes
uses: dorny/[email protected]
id: diff
with:
filters: |
isRust:
- 'rust/**'
- '.github/workflows/rust.yml'
isDoc:
- 'docs/**'
- 'README.md'
- '.github/workflows/deploy-docs.yml'
isMove:
- 'move/sources/**'
- 'Move.toml'
isScript:
- 'scripts/**'
- 'install'
- 'uninstall'
- 'update'
- 'repair'
- 'pip-install'
- '.github/workflows/scripts-tests.yml'
isDocHelperAPI:
- 'rust/helper/lib.rs'
- 'rust/helper/error.rs'
- '.github/workflows/trig-ext-repos.yml'
72 changes: 72 additions & 0 deletions .github/workflows/deploy-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
name: Deploy Vuepress

on:
push:
branches: [main]

workflow_dispatch:

permissions:
contents: write

jobs:
diff:
runs-on: [ubuntu-latest]
outputs:
isDoc: ${{ steps.diff.outputs.isDoc }}
steps:
- uses: actions/checkout@v3
- name: Detect Changes
uses: "./.github/actions/diffs"
id: diff

deploy-gh-pages:
needs: diff
if: ${{ (needs.diff.outputs.isDoc == 'true') || (github.event_name == 'workflow_dispatch') }}

runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Install Python
uses: actions/setup-python@v4
with:
python-version: "3.10"

- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: 8
run_install: true

- name: Copy pnpm dependency files
run: |
cp -f $GITHUB_WORKSPACE/docs/ci/pnpm-lock.yaml.ci $GITHUB_WORKSPACE/docs/pnpm-lock.yaml
cp -f $GITHUB_WORKSPACE/docs/ci/package.json.ci $GITHUB_WORKSPACE/docs/package.json
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 18
cache: pnpm
cache-dependency-path: "docs/pnpm-lock.yaml"

- name: Build Docs
env:
NODE_OPTIONS: --max_old_space_size=8192
run: |-
cd docs
pnpm run docs:build
> src/.vuepress/dist/.nojekyll
- name: Deploy Docs
uses: JamesIves/github-pages-deploy-action@v4
with:
# This is the branch where the docs are deployed to
branch: gh-pages
folder: docs/src/.vuepress/dist
49 changes: 0 additions & 49 deletions .github/workflows/docs.yml

This file was deleted.

5 changes: 5 additions & 0 deletions docs/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@

node_modules/
src/.vuepress/.cache/
src/.vuepress/.temp/
src/.vuepress/dist/
17 changes: 17 additions & 0 deletions docs/ci/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
DO NOT MODIFY the files in this directory
Do not update these files.

**What are they for?**

They are used by github action for CI deployment.

Only the maintainer of the website update these.

This is done such that minor difference in
installation in someones setup does not clash
with the intent from the website maintainers.

**How to update?**
From root of the docs:
cp package.json ci/package.json.ci
cp pnpm-lock.yaml ci/pnpm-lock.yaml.ci
20 changes: 20 additions & 0 deletions docs/ci/package.json.ci
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"name": "dtp",
"version": "0.0.1",
"description": "Decentralized Transport Protocol",
"license": "Apache 2.0",
"type": "module",
"scripts": {
"start": "vuepress dev src",
"docs:build": "vuepress-vite build src",
"docs:clean-dev": "vuepress-vite dev src --clean-cache",
"docs:dev": "vuepress-vite dev src",
"docs:update-package": "pnpm dlx vp-update"
},
"devDependencies": {
"@vuepress/bundler-vite": "2.0.0-rc.7",
"vue": "^3.4.19",
"vuepress": "2.0.0-rc.7",
"vuepress-theme-hope": "2.0.0-rc.23"
}
}
Loading

0 comments on commit 06cbe60

Please sign in to comment.