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 2019/11/11 03:56:19 UTC

[calcite] 02/02: Try Github actions

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

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

commit 365eb23701de5860713255e23dbd95122e2751d4
Author: Francis Chuang <fr...@apache.org>
AuthorDate: Wed Aug 14 10:44:09 2019 +1000

    Try Github actions
---
 .github/workflows/generate-javadoc.yml | 36 ++++++++++++++++++++++++++++++++++
 .github/workflows/publish-site.yml     | 33 +++++++++++++++++++++++++++++++
 2 files changed, 69 insertions(+)

diff --git a/.github/workflows/generate-javadoc.yml b/.github/workflows/generate-javadoc.yml
new file mode 100644
index 0000000..a7df13b
--- /dev/null
+++ b/.github/workflows/generate-javadoc.yml
@@ -0,0 +1,36 @@
+name: Publish the javadoc
+
+on:
+  create:
+    tags:
+      - "*"
+
+jobs:
+  publish:
+    name: Publish javadoc
+    runs-on: ubuntu-latest
+    steps:
+      - name: Generate Javadoc only if the tag is a release
+        env:
+          TAG: ${{ github.event.ref }}
+        run: if [[ ! $TAG =~ ^calcite-[[:digit:]]+\.[[:digit:]]+\.[[:digit:]]+$ ]]; then touch /tmp/exit; fi
+      - name: Checking out Calcite repository
+        uses: actions/checkout@v1
+      - name: Generate javadoc
+        working-directory: site
+        run: |
+          if [[ -f /tmp/exit ]]; then exit 0; fi
+          docker-compose run -u $(id -u):$(id -g) generate-javadoc
+      - name: Deploy javadoc to calcite-site repository
+        working-directory: site
+        run: |
+          if [[ -f /tmp/exit ]]; then exit 0; fi
+          git config --global user.email "builds@apache.org"
+          git config --global user.name "Calcite Automated Website Build"
+          git clone --depth 1 --branch asf-site https://gitbox.apache.org/repos/asf/calcite-site.git deploy
+          cd deploy/
+          rm -rf apidocs/ testapidocs/
+          cp -r ../target/* .
+          git add .
+          git commit -m "Automatic javadoc deployment from Calcite at $GITHUB_SHA"
+          git push origin HEAD:asf-site
\ No newline at end of file
diff --git a/.github/workflows/publish-site.yml b/.github/workflows/publish-site.yml
new file mode 100644
index 0000000..da36eb6
--- /dev/null
+++ b/.github/workflows/publish-site.yml
@@ -0,0 +1,33 @@
+name: Publish the website
+
+on:
+  push:
+    branches:
+      - test-site
+
+jobs:
+  publish:
+    name: Publish site
+    runs-on: ubuntu-latest
+    steps:
+      - name: Checking out Calcite repository
+        uses: actions/checkout@v1
+      - name: Build site assets
+        working-directory: site
+        run: docker-compose run -e JEKYLL_UID=$(id -u) -e JEKYLL_GID=$(id -g) build-site
+      - name: Deploy site to calcite-site repository
+        env:
+          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+        working-directory: site
+        run: |
+          shopt -s extglob
+          git config --global user.email "builds@apache.org"
+          git config --global user.name "Calcite Automated Website Build"
+          git config --global url."https://github:${GITHUB_TOKEN}@github.com/".insteadOf "https://github.com/"
+          git clone --depth 1 --branch asf-site https://github.com/apache/calcite-site deploy
+          cd deploy/
+          rm -rf !(apidocs|avatica|testapidocs)
+          cp -r ../target/* .
+          git add .
+          git commit -m "Automatic site deployment from Calcite at $GITHUB_SHA"
+          git push origin HEAD:asf-site
\ No newline at end of file