element-web-Github/.github/workflows/docs.yml

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

108 lines
3.3 KiB
YAML
Raw Permalink Normal View History

2023-10-17 06:57:03 +08:00
name: Deploy documentation
on:
push:
branches: [develop]
2023-10-17 06:57:03 +08:00
workflow_dispatch: {}
permissions: {}
2023-10-17 15:58:27 +08:00
concurrency:
group: "pages"
cancel-in-progress: false
2023-10-17 15:58:27 +08:00
2023-10-17 06:57:03 +08:00
jobs:
2023-10-17 15:58:27 +08:00
build:
2023-10-17 06:57:03 +08:00
name: GitHub Pages
runs-on: ubuntu-24.04
2023-10-17 06:57:03 +08:00
steps:
- name: Fetch element-desktop
uses: actions/checkout@v4
with:
2023-12-12 18:31:44 +08:00
repository: element-hq/element-desktop
2023-10-17 06:57:03 +08:00
path: element-desktop
- name: Fetch element-web
uses: actions/checkout@v4
with:
path: element-web
- name: Fetch matrix-js-sdk
uses: actions/checkout@v4
with:
repository: matrix-org/matrix-js-sdk
path: matrix-js-sdk
- uses: actions/setup-node@v4
2023-10-27 21:25:38 +08:00
with:
cache: "yarn"
2023-10-27 22:00:15 +08:00
cache-dependency-path: element-web/yarn.lock
2024-07-09 22:51:43 +08:00
node-version: "lts/*"
2023-10-27 21:25:38 +08:00
- name: Generate automations docs
working-directory: element-web
run: |
yarn install --frozen-lockfile
yarn ts-node ./scripts/gen-workflow-mermaid.ts ../element-desktop ../element-web ../matrix-js-sdk > docs/automations.md
2023-10-27 21:25:38 +08:00
echo "- [Automations](automations.md)" >> docs/SUMMARY.md
2023-10-17 06:57:03 +08:00
- name: Setup mdBook
uses: peaceiris/actions-mdbook@v2
2023-10-17 06:57:03 +08:00
with:
mdbook-version: "0.4.10"
2023-10-26 15:40:33 +08:00
- name: Install mdbook extensions
2024-07-02 17:14:44 +08:00
run: cargo install mdbook-combiner mdbook-mermaid
2023-10-17 06:57:03 +08:00
2023-10-17 15:48:19 +08:00
- name: Prepare docs
2023-10-17 06:57:03 +08:00
run: |
mkdir docs
2023-10-17 15:48:19 +08:00
mv element-desktop/README.md element-desktop/docs/
mv element-desktop/docs "docs/Element Desktop"
2023-10-17 15:48:19 +08:00
mv element-web/README.md element-web/docs/
mv element-web/docs/lib docs/
mv element-web/docs "docs/Element Web"
2023-10-17 15:48:19 +08:00
mv matrix-js-sdk/README.md matrix-js-sdk/docs/
mv matrix-js-sdk/docs "docs/Matrix JS SDK"
sed -i -e 's/\.\.\/README.md/README.md/' docs/**/SUMMARY.md
2023-10-17 15:48:19 +08:00
2023-10-17 06:57:03 +08:00
mdbook-combiner -m docs
sed -i -E 's/^\t# (.+)$/- [\1]()/gm;t' SUMMARY.md
sed -i -E 's/^- \[(.+)]\(<>\)$/---\n# \1/gm;t' SUMMARY.md
sed -i -E 's/\t- \[Introduction]/- [Introduction]/gm;t' SUMMARY.md
cat <<EOF > docs/SUMMARY.md
# Summary
- [Introduction](<Element Web/README.md>)
EOF
cat SUMMARY.md >> docs/SUMMARY.md
2023-10-17 15:48:19 +08:00
mv element-web/book.toml .
- name: Build docs
run: mdbook build
2023-10-17 06:57:03 +08:00
2023-10-17 15:58:27 +08:00
- name: Upload artifact
2024-01-10 18:20:33 +08:00
uses: actions/upload-pages-artifact@v3
2023-10-17 06:57:03 +08:00
with:
2023-10-17 15:58:27 +08:00
path: ./book
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-24.04
permissions:
pages: write
id-token: write
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4