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] 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.git
The following commit(s) were added to refs/heads/master by this push:
new 970ba27 [CALCITE-3129] Automate website builds
970ba27 is described below
commit 970ba276e78f15e65382b6d881519a65d1a60d45
Author: Francis Chuang <fr...@apache.org>
AuthorDate: Wed Mar 30 11:16:04 2022 +1100
[CALCITE-3129] Automate website builds
---
.../publish-non-release-website-updates.yml | 61 ++++++++++++++++++++++
.github/workflows/publish-website-on-release.yml | 55 +++++++++++++++++++
site/README.md | 45 ++--------------
3 files changed, 121 insertions(+), 40 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..2026b41
--- /dev/null
+++ b/.github/workflows/publish-non-release-website-updates.yml
@@ -0,0 +1,61 @@
+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/history.md' # unless the file is site/_docs/history.md
+ - 'site/_docs/howto.md' # or site/_docs/history.md
+ - 'site/_docs/powered_by.md' # or site/_docs/powered_by.md
+
+jobs:
+ cherry-pick-to-site:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v3
+ with:
+ fetch-depth: 0
+ ref: site
+ - name: Cherry pick the commit to site
+ run: |
+ git config user.email ${{ github.actor }}@users.noreply.github.com
+ git config user.name ${{ github.actor }}
+ git cherry-pick $GITHUB_SHA
+ git push origin site
+
+ publish-website:
+ runs-on: ubuntu-latest
+ needs: cherry-pick-to-site
+ steps:
+ - uses: actions/checkout@v3
+ with:
+ ref: site
+ - name: Build site
+ working-directory: site
+ run: |
+ docker-compose run -e JEKYLL_UID=$(id -u) -e JEKYLL_GID=$(id -g) build-site
+ - name: Push site
+ working-directory: site/target
+ env:
+ CALCITE_WEBSITE_BUILD: ${{ secrets.CALCITE_WEBSITE_BUILD }}
+ run: |
+ git config --global init.defaultBranch master
+ git init # Turn the folder into a git repo
+ git config url."https://asf-ci-deploy:$CALCITE_WEBSITE_BUILD@github.com/".insteadOf "https://github.com/"
+ git config user.email ${{ github.actor }}@users.noreply.github.com
+ git config user.name ${{ github.actor }}
+ git remote add origin https://github.com/apache/calcite-site
+ git fetch # Pull from the calcite-site repo
+ git reset origin/master --soft # Bring in changes from the calcite-site repo, but keep our local changes
+ git reset -- javadocAggregate/ # Restore the javadoc
+ git checkout -- javadocAggregate/
+ git reset -- avatica/ # Restore the avatica site
+ git checkout -- avatica/
+ git add .
+ if ! git diff-index --quiet HEAD; then
+ git commit -m "Website deployed from calcite@$GITHUB_SHA"
+ git push origin master
+ fi
diff --git a/.github/workflows/publish-website-on-release.yml b/.github/workflows/publish-website-on-release.yml
new file mode 100644
index 0000000..16c821b
--- /dev/null
+++ b/.github/workflows/publish-website-on-release.yml
@@ -0,0 +1,55 @@
+name: Publish website on release
+
+on:
+ push:
+ tags:
+ - calcite-[0-9]+.[0-9]+.[0-9]+ # Trigger only when a tag that matches calcite-X.Y.Z is pushed
+
+jobs:
+ sync-master-site:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v3
+ with:
+ fetch-depth: 0
+ ref: site
+ - name: Sync master and site branches
+ run: |
+ git reset --hard origin/master
+ git push --force origin site
+
+ publish-website:
+ runs-on: ubuntu-latest
+ needs: sync-master-site
+ steps:
+ - uses: actions/checkout@v3
+ with:
+ ref: site
+ - 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
+ - name: Push site
+ working-directory: site/target
+ env:
+ CALCITE_WEBSITE_BUILD: ${{ secrets.CALCITE_WEBSITE_BUILD }}
+ run: |
+ git config --global init.defaultBranch master
+ git init # Turn the folder into a git repo
+ git config url."https://asf-ci-deploy:$CALCITE_WEBSITE_BUILD@github.com/".insteadOf "https://github.com/"
+ git config user.email ${{ github.actor }}@users.noreply.github.com
+ git config user.name ${{ github.actor }}
+ git remote add origin https://github.com/apache/calcite-site
+ git fetch # Pull from the calcite-site repo
+ git reset origin/master --soft # Bring in changes from the calcite-site repo, but keep our local changes
+ git reset -- avatica/ # Restore the avatica site
+ git checkout -- avatica/
+ git add .
+ if ! git diff-index --quiet HEAD; then
+ git commit -m "Website deployed from calcite@$GITHUB_SHA"
+ git push origin master
+ fi
diff --git a/site/README.md b/site/README.md
index 2d6f88a..03ee7d8 100644
--- a/site/README.md
+++ b/site/README.md
@@ -27,13 +27,11 @@ We want to deploy project changes (for example, new committers, PMC members or u
immediately, but we want to deploy documentation of project features only when that feature appears
in a release.
-The procedure for deploying changes to the website is outlined below:
-1. Push the commit with the changes to the `master` branch of this repository.
-2. Cherry-pick the commit from the `master` branch to the `site` branch of this repository.
-3. Checkout the `site` branch and build the website either [manually](#manually) or using
-[docker-compose](#using-docker) (preferred).
-4. Commit the generated content to the `master` branch of the `calcite-site` repository following
-the [Pushing to site](#pushing-to-site) instructions.
+The building and publishing of the website is completely automated using Github actions, so you should simply commit
+your changes to master. If you are committing a change to the website that needs to be published immediately, the
+Github action uses these [rules](../.github/workflows/publish-non-release-website-updates.yml#L7).
+
+# Previewing the website locally
## Manually
@@ -95,36 +93,3 @@ You can preview your work while working on the site.
The web server will be started on [http://localhost:4000](http://localhost:4000)
As you make changes to the site, the site will automatically rebuild.
-
-## Pushing to site
-
-1. `cd site/target`
-2. `git init`
-3. `git remote add origin git@github.com:apache/calcite-site.git`
-4. `git fetch`
-5. `git reset origin/master --soft`
-
-If you have not regenerated the javadoc and they are missing, restore them:
-
-6. `git reset -- javadocAggregate/`
-7. `git checkout -- javadocAggregate/`
-
-Restore the avatica site
-
-8. `git reset -- avatica/`
-9. `git checkout -- avatica/`
-
-10. `git add .`
-11. Commit: `git commit -m "Your commit message goes here"`
-12. Push the site: `git push origin master`
-
-Within a few minutes, gitpubsub should kick in and you'll be able to
-see the results at
-[calcite.apache.org](https://calcite.apache.org/).
-
-This process also publishes Avatica's web site. Avatica's web site has
-separate source (under `avatica/site`) but configures Jekyll to
-generate files to `site/target/avatica`, which becomes an
-[avatica](https://calcite.apache.org/avatica)
-sub-directory when deployed. See
-[Avatica site README](../avatica/site/README.md).