Add version switcher to documentation build (#307)

Closes #303.
diff --git a/docs/source/conf.py b/docs/source/conf.py
index 2365631..a6fa729 100644
--- a/docs/source/conf.py
+++ b/docs/source/conf.py
@@ -17,6 +17,7 @@
 
 import datetime
 import os
+import re
 import sys
 
 # Configuration file for the Sphinx documentation builder.
@@ -39,6 +40,17 @@
 author = "Apache Software Foundation"
 
 
+def get_version():
+    cmakelists = os.path.join("..", "..", "CMakeLists.txt")
+    with open(cmakelists, "r") as f:
+        for line in f:
+            if "NANOARROW_VERSION" in line:
+                if "SNAPSHOT" in line:
+                    return "dev"
+                else:
+                    return re.findall(r"[0-9]+\.[0-9]+\.[0-9]+", line)[0]
+
+
 # -- General configuration ---------------------------------------------------
 
 # Add any Sphinx extension module names here, as strings. They can be
@@ -77,6 +89,11 @@
     "show_toc_level": 2,
     "use_edit_page_button": True,
     "external_links": [],
+    "switcher": {
+        "json_url": "https://arrow.apache.org/nanoarrow/switcher.json",
+        "version_match": get_version(),
+    },
+    "navbar_start": ["navbar-logo", "version-switcher"],
 }
 
 html_context = {