Fokko commented on code in PR #8919:
URL: https://github.com/apache/iceberg/pull/8919#discussion_r1386524118


##########
site/dev/common.sh:
##########
@@ -0,0 +1,122 @@
+#!/usr/bin/env bash
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+set -e
+
+mv_nightly_up () {
+  mv docs/docs/nightly/ docs/
+}
+
+mv_nightly_down () {
+  mv docs/nightly/ docs/docs/
+}
+
+install_deps () {
+  pip install -r requirements.txt --upgrade
+}
+
+assert_not_empty () {
+  if [ -z "$1" ]
+    then
+      echo "No argument supplied"
+      exit 1
+  fi 
+}
+
+get_latest_version () {
+  basename $(ls -d docs/docs/*/ | sort -V | tail -1)
+}
+
+update_version () {
+  local ICEBERG_VERSION="$1"
+  assert_not_empty "${ICEBERG_VERSION}"
+
+  sed -i '' -E "s/(^site\_name:[[:space:]]+docs\/).*$/\1${ICEBERG_VERSION}/" 
${ICEBERG_VERSION}/mkdocs.yml
+  sed -i '' -E 
"s/(^[[:space:]]*-[[:space:]]+Javadoc:.*\/javadoc\/).*$/\1${ICEBERG_VERSION}/" 
${ICEBERG_VERSION}/mkdocs.yml
+
+  #sed -i '' -E "s/    \- latest: '\!include 
docs\/docs\/latest\/mkdocs\.yml'/a    \- ${ICEBERG_VERSION}: '\!include 
docs\/docs\/${ICEBERG_VERSION}\/mkdocs\.yml/" ../../mkdocs.yml
+}
+
+create_latest () {
+  local ICEBERG_VERSION="$1"
+  assert_not_empty "${ICEBERG_VERSION}"
+
+  rm -rf docs/docs/latest/
+  mkdir docs/docs/latest/
+
+  ln -s "../${ICEBERG_VERSION}/docs" docs/docs/latest/docs
+  cp "docs/docs/${ICEBERG_VERSION}/mkdocs.yml" docs/docs/latest/
+
+  cd docs/docs/
+  update_version "latest"
+  cd -
+}
+
+
+# 
https://squidfunk.github.io/mkdocs-material/setup/setting-up-site-search/#search-exclusion
+search_exclude_versioned_docs () {
+  local ICEBERG_VERSION="$1"
+  assert_not_empty "${ICEBERG_VERSION}"
+
+  cd "${ICEBERG_VERSION}/docs/"
+  
+  python3 -c "import os
+for f in filter(lambda x: x.endswith('.md'), os.listdir()): lines = 
open(f).readlines(); open(f, 'w').writelines(lines[:2] + ['search:\n', '  
exclude: true\n'] + lines[2:]);"
+  
+  cd -
+}
+
+pull_versioned_docs () {
+  mv_nightly_up 
+  
+  git worktree add docs/docs docs
+  git worktree add docs/javadoc javadoc

Review Comment:
   ```suggestion
     git remote add iceberg-docs https://github.com/apache/iceberg.git
     git remote fetch iceberg-docs
     git worktree add docs/docs iceberg-docs/docs
     git worktree add docs/javadoc iceberg-docs/javadoc
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org
For additional commands, e-mail: issues-h...@iceberg.apache.org

Reply via email to