You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by pr...@apache.org on 2020/08/25 02:59:12 UTC

[incubator-nuttx-website] 01/02: Add logic for publishing documentation from sphinx docs

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

protobits pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx-website.git

commit 9585444db033d12f887d71f0bd28dad18a2c4c23
Author: Brennan Ashton <ba...@brennanashton.com>
AuthorDate: Mon Aug 24 17:16:13 2020 -0700

    Add logic for publishing documentation from sphinx docs
    
    Signed-off-by: Brennan Ashton <ba...@brennanashton.com>
---
 .github/workflows/main.yml               | 16 +++++++++++++++-
 .gitignore                               |  3 +++
 _config.yml                              |  2 +-
 _includes/themes/apache/_navigation.html |  1 +
 index.md                                 |  2 +-
 publish.sh                               | 14 +++++++++++---
 6 files changed, 32 insertions(+), 6 deletions(-)

diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index e113375..7db7b38 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -1,6 +1,9 @@
 name: CI
 
 on:
+  repository_dispatch:
+    types: docs
+  workflow_dispatch:
   pull_request:
   push:
     branches:
@@ -14,6 +17,17 @@ jobs:
     - run: |
         git fetch --prune --unshallow
 
+    - name: Checkout NuttX Documentation
+      uses: actions/checkout@v2
+      with:
+        repository: apache/incubator-nuttx
+        fetch-depth: 1
+        ref: master
+        path: nuttx/master
+    - uses: ammaraskar/sphinx-action@master
+      with:
+        docs-folder: "nuttx/master/Documentation/"
+
     - name: Install tools
       run: |
         sudo apt-get -y install rubygems ruby-dev zlib1g-dev
@@ -29,6 +43,6 @@ jobs:
         ./publish.sh
 
     - name: Publish Site
-      if: github.event_name == 'push' && github.ref == 'refs/heads/master'
+      if: (github.event_name == 'push' || github.event_name == 'repository_dispatch' || github.event_name == 'workflow_dispatch' ) && github.ref == 'refs/heads/master'
       run: |
         git push origin asf-site:asf-site
diff --git a/.gitignore b/.gitignore
index 10bb84a..21cbe09 100644
--- a/.gitignore
+++ b/.gitignore
@@ -38,3 +38,6 @@ target
 vendor
 
 .bundle
+
+# NuttX documentation
+nuttx/
diff --git a/_config.yml b/_config.yml
index b1618cd..2407e5c 100644
--- a/_config.yml
+++ b/_config.yml
@@ -19,7 +19,7 @@ excerpt_separator: ""
 
 repository: https://github.com/apache/apache-website-template
 destination: target
-exclude: [README.md,Gemfile*,vendor]
+exclude: [README.md,Gemfile*,vendor,nuttx]
 keep_files: [".git", ".svn", "apidocs"]
 
 # The base path where the website is deployed
diff --git a/_includes/themes/apache/_navigation.html b/_includes/themes/apache/_navigation.html
index 2aceb6a..70aed13 100644
--- a/_includes/themes/apache/_navigation.html
+++ b/_includes/themes/apache/_navigation.html
@@ -21,6 +21,7 @@
                 <li><a href="{{ site.baseurl }}/community-members">Who we are</a></li>
                </ul>
             </li>
+	    <li><a href="{{ site.baseurl }}/docs/latest">Documentation</a></li>
             <li><a href="{{ site.data.project.source_repository_os_mirror }}">GitHub</a></li>
             <li id="apache">
               <a href="#" data-toggle="dropdown" class="dropdown-toggle">Apache<b class="caret"></b></a>
diff --git a/index.md b/index.md
index dd9db93..5c5f295 100644
--- a/index.md
+++ b/index.md
@@ -38,4 +38,4 @@ as fork()).
 
 ## Documentation
 
-Extensive documentation can be found on the project [wiki](https://cwiki.apache.org/{{ site.data.project.wiki }}/Nuttx).
+Extensive documentation can be found [here]({{ site.baseurl }}/docs/latest).
diff --git a/publish.sh b/publish.sh
index 592ccb5..dc393fc 100755
--- a/publish.sh
+++ b/publish.sh
@@ -18,20 +18,28 @@
 
 set -e
 
+echo "Prior to running this make sure that the NuttX repo is checked out"
+echo "to nuttx/master 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 .
 
-COMMIT_HASH=`git rev-parse HEAD`
+mkdir -p target/docs/
+cp -r nuttx/master/Documentation/_build/html target/docs/latest
+
+COMMIT_HASH_WEB=`git rev-parse HEAD`
+COMMIT_HASH_NUTTX=`git -C nuttx/master rev-parse HEAD`
 git checkout asf-site
 #git pull --rebase
 rm -rf content
 mv target content
 git add content
-echo "Publishing changes from master branch $COMMIT_HASH"
-git commit -a -m "Publishing from $COMMIT_HASH"
+echo "Publishing website master branch $COMMIT_HASH_WEB"
+echo "Publishing docs from NuttX master branch $COMMIT_HASH_WEB"
+git commit -a -m "Publishing web: $COMMIT_HASH_WEB docs: $COMMIT_HASH_NUTTX"
 echo " "
 echo "==================================================================="
 echo "You are now on the asf-site branch with your new changes committed."