2023-10-17 06:57:03 +08:00
|
|
|
name: Deploy documentation
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches: [develop]
|
|
|
|
workflow_dispatch: {}
|
|
|
|
|
2023-10-17 15:58:27 +08:00
|
|
|
permissions:
|
2023-10-17 16:16:32 +08:00
|
|
|
contents: read
|
|
|
|
pages: write
|
|
|
|
id-token: write
|
2023-10-17 15:58:27 +08:00
|
|
|
|
|
|
|
concurrency:
|
2023-10-17 16:16:32 +08:00
|
|
|
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-latest
|
|
|
|
steps:
|
|
|
|
- name: Fetch element-desktop
|
|
|
|
uses: actions/checkout@v4
|
|
|
|
with:
|
|
|
|
repository: vector-im/element-desktop
|
|
|
|
path: element-desktop
|
|
|
|
|
|
|
|
- name: Fetch element-web
|
|
|
|
uses: actions/checkout@v4
|
|
|
|
with:
|
|
|
|
path: element-web
|
|
|
|
|
|
|
|
- name: Fetch matrix-react-sdk
|
|
|
|
uses: actions/checkout@v4
|
|
|
|
with:
|
|
|
|
repository: matrix-org/matrix-react-sdk
|
|
|
|
path: matrix-react-sdk
|
|
|
|
|
2023-10-17 17:01:56 +08:00
|
|
|
- name: Fetch matrix-js-sdk
|
|
|
|
uses: actions/checkout@v4
|
|
|
|
with:
|
|
|
|
repository: matrix-org/matrix-js-sdk
|
|
|
|
path: matrix-js-sdk
|
|
|
|
|
2023-10-17 06:57:03 +08:00
|
|
|
- name: Setup mdBook
|
|
|
|
uses: peaceiris/actions-mdbook@v1
|
|
|
|
with:
|
|
|
|
mdbook-version: "0.4.10"
|
|
|
|
|
|
|
|
- name: Install mdbook-combiner
|
|
|
|
run: cargo install mdbook-combiner
|
|
|
|
|
2023-10-17 15:48:19 +08:00
|
|
|
- name: Prepare docs
|
2023-10-17 06:57:03 +08:00
|
|
|
run: |
|
2023-10-17 16:16:32 +08:00
|
|
|
mkdir docs
|
2023-10-17 15:48:19 +08:00
|
|
|
|
2023-10-17 16:16:32 +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
|
|
|
|
2023-10-17 16:16:32 +08:00
|
|
|
mv element-web/README.md element-web/docs/
|
|
|
|
mv element-web/docs "docs/Element Web"
|
2023-10-17 15:48:19 +08:00
|
|
|
|
2023-10-17 16:16:32 +08:00
|
|
|
mv matrix-react-sdk/README.md matrix-react-sdk/docs/
|
|
|
|
mv matrix-react-sdk/docs "docs/Matrix React SDK"
|
|
|
|
|
2023-10-17 17:01:56 +08:00
|
|
|
mv matrix-js-sdk/README.md matrix-js-sdk/docs/
|
|
|
|
mv matrix-js-sdk/docs "docs/Matrix JS SDK"
|
|
|
|
|
2023-10-17 16:16:32 +08:00
|
|
|
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
|
2023-10-17 17:25:27 +08:00
|
|
|
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
|
|
|
|
uses: actions/upload-pages-artifact@v2
|
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-latest
|
|
|
|
needs: build
|
|
|
|
steps:
|
|
|
|
- name: Deploy to GitHub Pages
|
|
|
|
id: deployment
|
|
|
|
uses: actions/deploy-pages@v2
|