You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@calcite.apache.org by fr...@apache.org on 2022/03/31 04:13:18 UTC

[calcite-avatica] branch master updated: [CALCITE-3129] Automate website builds

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

francischuang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/calcite-avatica.git


The following commit(s) were added to refs/heads/master by this push:
     new b9aa1fb  [CALCITE-3129] Automate website builds
b9aa1fb is described below

commit b9aa1fb97189c082598daa72d997451878a25cbf
Author: Francis Chuang <fr...@apache.org>
AuthorDate: Wed Mar 30 19:43:38 2022 +1100

    [CALCITE-3129] Automate website builds
---
 .../publish-non-release-website-updates.yml        | 42 ++++++++++++++++++++++
 .../publish-site-and-javadocs-on-release.yml       | 37 +++++++++++++++++++
 site/README.md                                     | 10 +++---
 site/add-avatica-go-docs.sh                        | 10 ++++++
 4 files changed, 93 insertions(+), 6 deletions(-)

diff --git a/.github/workflows/publish-non-release-website-updates.yml b/.github/workflows/publish-non-release-website-updates.yml
new file mode 100644
index 0000000..e0ef396
--- /dev/null
+++ b/.github/workflows/publish-non-release-website-updates.yml
@@ -0,0 +1,42 @@
+name: Publish non-release website updates
+
+on:
+  push:
+    branches:
+      - master
+    paths:
+      - 'site/**'                       # Trigger only for changes to files in the site/ folder
+      - '!site/_docs/**'                # except for files in the site/_docs/ folder
+      - 'site/_docs/docker_images.md'   # unless the file is site/_docs/docker_images.md
+      - 'site/_docs/history.md'         # or site/_docs/history.md
+      - 'site/_docs/howto.md'           # or site/_docs/howto.md
+      - 'site/_docs/index.md'           # or site/_docs/index.md
+
+jobs:
+   publish-website:
+    runs-on: ubuntu-latest
+    steps:
+      - uses: actions/checkout@v3
+      - name: Build site
+        working-directory: site
+        run: |
+          docker-compose run -e JEKYLL_UID=$(id -u) -e JEKYLL_GID=$(id -g) build-site
+      - uses: actions/checkout@v3
+        with:
+          repository: apache/calcite-site
+          path: calcite-site
+          token: ${{ secrets.CALCITE_WEBSITE_BUILD }}
+      - name: Publish site
+        working-directory: calcite-site
+        run: |
+          git config user.email ${{ github.actor }}@users.noreply.github.com
+          git config user.name ${{ github.actor }}
+          rm -rf avatica/
+          mv ../site/target/avatica/ .
+          git reset -- avatica/javadocAggregate/       # Restore the avatica javadoc
+          git checkout -- avatica/javadocAggregate/
+          git add .
+          if ! git diff-index --quiet HEAD; then
+            git commit -m "Website deployed from calcite-avatica@$GITHUB_SHA"
+            git push origin master
+          fi
diff --git a/.github/workflows/publish-site-and-javadocs-on-release.yml b/.github/workflows/publish-site-and-javadocs-on-release.yml
new file mode 100644
index 0000000..3b95450
--- /dev/null
+++ b/.github/workflows/publish-site-and-javadocs-on-release.yml
@@ -0,0 +1,37 @@
+name: Publish website on release
+
+on:
+  push:
+    tags:
+      - rel/avatica-[0-9]+.[0-9]+.[0-9]+ # Trigger only when the tag matches rel/avatica-X.Y.Z
+
+jobs:
+  publish-website:
+    runs-on: ubuntu-latest
+    steps:
+      - uses: actions/checkout@v3
+      - name: Build site
+        working-directory: site
+        run: |
+          docker-compose run -e JEKYLL_UID=$(id -u) -e JEKYLL_GID=$(id -g) build-site
+      - name: Build javadoc
+        working-directory: site
+        run: |
+          docker-compose run generate-javadoc
+      - uses: actions/checkout@v3
+        with:
+          repository: apache/calcite-site
+          path: calcite-site
+          token: ${{ secrets.CALCITE_WEBSITE_BUILD }}
+      - name: Publish site
+        working-directory: calcite-site
+        run: |
+          git config user.email ${{ github.actor }}@users.noreply.github.com
+          git config user.name ${{ github.actor }}
+          rm -rf avatica/
+          mv ../site/target/avatica/ .
+          git add .
+          if ! git diff-index --quiet HEAD; then
+            git commit -m "Website deployed from calcite-avatica@$GITHUB_SHA"
+            git push origin master
+          fi
diff --git a/site/README.md b/site/README.md
index 7138c04..c23c05b 100644
--- a/site/README.md
+++ b/site/README.md
@@ -26,6 +26,10 @@ a sub-directory of the
 
 You can build the site manually using your environment or use the docker compose file.
 
+The site is automatically built and published following the process outlined in the [Calcite repository](https://github.com/apache/calcite/blob/master/site/README.md).
+
+# Previewing the website locally
+
 ## Building website on a host system
 
 ### Setup your environment
@@ -85,9 +89,3 @@ You can preview your work while working on the site.
 The web server will be started on [http://localhost:4000/avatica/](http://localhost:4000/avatica/) (note the trailing slash)
 
 As you make changes to the site, the site will automatically rebuild.
-
-## Pushing to site
-
-Push the Calcite site, which includes `avatica` as a sub-directory,
-as described in its
-[README](../site/README.md).
diff --git a/site/add-avatica-go-docs.sh b/site/add-avatica-go-docs.sh
index 5c03382..37ca134 100755
--- a/site/add-avatica-go-docs.sh
+++ b/site/add-avatica-go-docs.sh
@@ -17,6 +17,16 @@
 #
 git clone https://github.com/apache/calcite-avatica-go /tmp/calcite-avatica-go
 
+CURRENT_DIR=$PWD
+
+ # Reset the client reference to the last release (so that unreleased changes are not published)
+cd /tmp/calcite-avatica-go
+
+LATEST_TAG=$(git describe --exclude "*-rc*" --tags --abbrev=0)
+git checkout tags/$LATEST_TAG site/_docs/go_client_reference.md
+
+cd $CURRENT_DIR
+
 cp /tmp/calcite-avatica-go/site/_docs/* _docs/
 cp /tmp/calcite-avatica-go/site/_posts/* _posts/
 cp /tmp/calcite-avatica-go/site/develop/* develop/