This is an automated email from the ASF dual-hosted git repository.

github-actions[bot] pushed a commit to branch asf-site
in repository https://gitbox.apache.org/repos/asf/nuttx-website.git


The following commit(s) were added to refs/heads/asf-site by this push:
     new 45fb182ce8 Publishing web: b3ba9359c605c5e92ad2feac6444e03d16143fd3
45fb182ce8 is described below

commit 45fb182ce8208095c179e024ba012f4d3b78e0a9
Author: Swatantra Yadav <[email protected]>
AuthorDate: Fri Oct 9 13:06:54 2026 +0000

    Publishing web: b3ba9359c605c5e92ad2feac6444e03d16143fd3
---
 content/feed.xml   |   4 +-
 content/publish.sh | 171 ++++++++++++++++++++++++++++++++++++++++++++---------
 2 files changed, 146 insertions(+), 29 deletions(-)

diff --git a/content/feed.xml b/content/feed.xml
index d52a734e6e..0616213190 100644
--- a/content/feed.xml
+++ b/content/feed.xml
@@ -5,8 +5,8 @@
     <description></description>
     <link>/</link>
     <atom:link href="/feed.xml" rel="self" type="application/rss+xml"/>
-    <pubDate>Fri, 09 Oct 2026 03:56:32 +0000</pubDate>
-    <lastBuildDate>Fri, 09 Oct 2026 03:56:32 +0000</lastBuildDate>
+    <pubDate>Fri, 09 Oct 2026 13:06:40 +0000</pubDate>
+    <lastBuildDate>Fri, 09 Oct 2026 13:06:40 +0000</lastBuildDate>
     <generator>Jekyll v4.4.1</generator>
     
       <item>
diff --git a/content/publish.sh b/content/publish.sh
index 815c902512..6ab6257171 100755
--- a/content/publish.sh
+++ b/content/publish.sh
@@ -18,35 +18,152 @@
 
 set -e
 
-echo "Prior to running this make sure that the NuttX repo is checked out"
-echo "to nuttx and the documentation html has been generated."
-
-gem install bundler:2.1.2
-bundle config set path 'vendor/bundle'
-bundle install 
-bundle exec jekyll clean --source .
-bundle exec jekyll build --source .
-
-# Gemfile.lock is sometimes updated, ignore that in CI.
-git checkout -- Gemfile.lock
-rm -rf target/docs
-mv docs target/
-
-COMMIT_HASH_WEB=`git rev-parse HEAD`
-COMMIT_HASH_NUTTX=`git -C nuttx rev-parse HEAD`
-git checkout asf-site
-#git pull --rebase
-rm -rf content
-mv target content
-git add content
-git status
-echo "Publishing website master branch $COMMIT_HASH_WEB"
-echo "Publishing docs from NuttX master branch $COMMIT_HASH_WEB"
-if git diff --staged --quiet; then
-  echo "No changes to commit or publish."
+MODE="${1:---all}"
+
+echo "==================================================================="
+echo " Running publish.sh in mode: $MODE"
+echo "==================================================================="
+
+COMMIT_HASH_WEB=$(git rev-parse HEAD)
+if [ -d "nuttx" ]; then
+  COMMIT_HASH_NUTTX=$(git -C nuttx rev-parse HEAD 2>/dev/null || echo "HEAD")
 else
-  git commit -a -m "Publishing web: $COMMIT_HASH_WEB docs: $COMMIT_HASH_NUTTX"
+  COMMIT_HASH_NUTTX="n/a"
 fi
+
+build_website() {
+  echo " ===> Building Jekyll website into target/..."
+  gem install bundler:2.1.2
+  bundle config set path 'vendor/bundle'
+  bundle install
+  bundle exec jekyll clean --source .
+  bundle exec jekyll build --source .
+  # Gemfile.lock is sometimes updated, ignore that in CI.
+  git checkout -- Gemfile.lock
+}
+
+stage_website_only() {
+  echo " ===> Staging website updates to asf-site (preserving content/docs)..."
+  if [ ! -d "target" ]; then
+    echo "::error::Directory 'target' does not exist. Build the website first."
+    exit 1
+  fi
+
+  git checkout asf-site
+  git pull --rebase origin asf-site 2>/dev/null || true
+
+  mkdir -p content
+  TEMP_DOCS_BACKUP=""
+  if [ -d "content/docs" ]; then
+    TEMP_DOCS_BACKUP=$(mktemp -d)
+    echo " ====> Backing up existing content/docs to $TEMP_DOCS_BACKUP/docs..."
+    mv content/docs "$TEMP_DOCS_BACKUP/docs"
+  fi
+
+  rm -rf content
+  mv target content
+
+  if [ -n "$TEMP_DOCS_BACKUP" ] && [ -d "$TEMP_DOCS_BACKUP/docs" ]; then
+    echo " ====> Restoring preserved content/docs..."
+    mv "$TEMP_DOCS_BACKUP/docs" content/docs
+    rm -rf "$TEMP_DOCS_BACKUP"
+  fi
+
+  git add content
+  git status
+  echo "Publishing website master branch $COMMIT_HASH_WEB"
+  if git diff --staged --quiet; then
+    echo "No changes to commit or publish for website."
+  else
+    git commit -a -m "Publishing web: $COMMIT_HASH_WEB"
+  fi
+}
+
+stage_docs_only() {
+  echo " ===> Staging documentation updates to asf-site (preserving 
website)..."
+  if [ ! -d "docs" ]; then
+    echo "::error::Directory 'docs' does not exist. Documentation must be 
generated first."
+    exit 1
+  fi
+
+  # Temporarily store docs outside git tree so git checkout asf-site does not 
wipe untracked docs
+  TEMP_STAGE_DOCS=$(mktemp -d)
+  mv docs "$TEMP_STAGE_DOCS/docs"
+
+  git checkout asf-site
+  git pull --rebase origin asf-site 2>/dev/null || true
+
+  mkdir -p content/docs
+  cp -a "$TEMP_STAGE_DOCS/docs/." content/docs/
+  rm -rf "$TEMP_STAGE_DOCS"
+
+  git add content/docs
+  git status
+  echo "Publishing docs from NuttX master branch $COMMIT_HASH_NUTTX"
+  if git diff --staged --quiet; then
+    echo "No changes to commit or publish for docs."
+  else
+    git commit -a -m "Publishing docs: $COMMIT_HASH_NUTTX (web: 
$COMMIT_HASH_WEB)"
+  fi
+}
+
+stage_all() {
+  echo " ===> Staging website and documentation..."
+  if [ ! -d "target" ]; then
+    echo "::error::Directory 'target' does not exist. Build the website first."
+    exit 1
+  fi
+
+  if [ -d "docs" ]; then
+    rm -rf target/docs
+    mv docs target/
+  fi
+
+  git checkout asf-site
+  git pull --rebase origin asf-site 2>/dev/null || true
+
+  # If docs was not present in target, preserve existing content/docs
+  if [ ! -d "target/docs" ] && [ -d "content/docs" ]; then
+    TEMP_DOCS_BACKUP=$(mktemp -d)
+    mv content/docs "$TEMP_DOCS_BACKUP/docs"
+    rm -rf content
+    mv target content
+    mv "$TEMP_DOCS_BACKUP/docs" content/docs
+    rm -rf "$TEMP_DOCS_BACKUP"
+  else
+    rm -rf content
+    mv target content
+  fi
+
+  git add content
+  git status
+  echo "Publishing website master branch $COMMIT_HASH_WEB"
+  echo "Publishing docs from NuttX master branch $COMMIT_HASH_NUTTX"
+  if git diff --staged --quiet; then
+    echo "No changes to commit or publish."
+  else
+    git commit -a -m "Publishing web: $COMMIT_HASH_WEB docs: 
$COMMIT_HASH_NUTTX"
+  fi
+}
+
+case "$MODE" in
+  --website|-w)
+    build_website
+    stage_website_only
+    ;;
+  --docs|-d)
+    stage_docs_only
+    ;;
+  --all|-a)
+    build_website
+    stage_all
+    ;;
+  *)
+    echo "Unknown option $MODE. Usage: $0 [--website | --docs | --all]"
+    exit 1
+    ;;
+esac
+
 echo " "
 echo "==================================================================="
 echo "You are now on the asf-site branch with your new changes committed."

Reply via email to