Skip to content

Update changelog

Update changelog #100

Workflow file for this run

name: Deploy the documentation
on:
push:
branches:
# For documentation specific to a release
- "famedly-release/v*"
# stable docs
- master
workflow_dispatch:
permissions:
contents: read
pages: write
id-token: write
jobs:
pre:
name: Calculate variables for GitHub Pages deployment
runs-on: ubuntu-latest
steps:
# Figure out the target directory.
#
# The target directory depends on the name of the branch
#
- name: Get the target directory name
id: vars
run: |
# first strip the 'refs/heads/' prefix with some shell foo
branch="${GITHUB_REF#refs/heads/}"
case $branch in
famedly-release/v*)
# strip 'release-' from the name for release branches.
branch="${branch#famedly-release/v}"
;;
master)
# deploy to "latest" for the master branch.
branch="latest"
;;
esac
# finally, set the 'branch-version' var.
echo "branch-version=$branch" >> "$GITHUB_OUTPUT"
outputs:
branch-version: ${{ steps.vars.outputs.branch-version }}
################################################################################
build:
name: GitHub Pages
runs-on: ubuntu-latest
needs:
- pre
steps:
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
with:
# Fetch all history so that the schema_versions script works.
fetch-depth: 0
- name: Caching
uses: Swatinem/rust-cache@98c8021b550208e191a6a3145459bfc9fb29c4c0 # v2.8.0
with:
shared-key: "mdbook"
save-if: ${{ ! startsWith(github.ref, 'gh-readonly-queue/') }}
- name: Install required tooling
run: |
cargo install mdbook-linkcheck mdbook-mermaid mdbook-admonish
cargo install mdbook --no-default-features --features search --vers "^0.4" --locked
- name: Setup Pages
id: pages
uses: actions/configure-pages@v5
- name: Setup mdbook-admonish
run: mdbook-admonish install
- name: Set version of docs
run: echo 'window.SYNAPSE_VERSION = "${{ needs.pre.outputs.branch-version }}";' > ./docs/website_files/version.js
- name: Setup python
uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v6.1.0
with:
python-version: "3.x"
- run: "pip install 'packaging>=20.0' 'GitPython>=3.1.20'"
- name: Build the documentation
# mdbook will only create an index.html if we're including docs/README.md in SUMMARY.md.
# However, we're using docs/README.md for other purposes and need to pick a new page
# as the default. Let's opt for the welcome page instead.
run: |
mdbook build
cp book/welcome_and_overview.html book/index.html
- name: Prepare and publish schema files
run: |
sudo apt-get update && sudo apt-get install -y yq
mkdir -p book/schema
# Remove developer notice before publishing.
rm schema/v*/Do\ not\ edit\ files\ in\ this\ folder
# Copy schema files that are independent from current Synapse version.
cp -r -t book/schema schema/v*/
# Convert config schema from YAML source file to JSON.
yq < schema/synapse-config.schema.yaml \
> book/schema/synapse-config.schema.json
- name: Restructure for versioning
run: |
# Create a clean output directory
mkdir -p _site/${{ needs.pre.outputs.branch-version }}
# Move the built book (and schemas) into the versioned subdirectory
mv book/* _site/${{ needs.pre.outputs.branch-version }}/
# Create a root index.html that redirects to the versioned docs
# This ensures https://famedly.github.io/synapse/ still works
if [ "${{ needs.pre.outputs.branch-version }}" = "latest" ]; then
echo '<!DOCTYPE html><meta http-equiv="refresh" content="0; url=latest/index.html">' > _site/index.html
fi
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: ./_site
deploy:
if: ${{ github.ref == 'refs/heads/master' }}
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: "pages"
cancel-in-progress: false
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@v4