This is an automated email from the ASF dual-hosted git repository. zregvart pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/camel-website.git
The following commit(s) were added to refs/heads/master by this push: new a9df86e chore: pull request previews a9df86e is described below commit a9df86e1d46c748aa28eed57648db7776e5c1014 Author: Zoran Regvart <zregvart+git...@gmail.com> AuthorDate: Sat Mar 2 21:10:20 2019 +0100 chore: pull request previews Using GitHub actions to create pull request previews. --- .github/action-website/Dockerfile | 1 + .github/action-website/publish | 18 ++++++++++++++++-- .github/main.workflow | 21 ++++++++++++++++++++- 3 files changed, 37 insertions(+), 3 deletions(-) diff --git a/.github/action-website/Dockerfile b/.github/action-website/Dockerfile index 9a2bc88..a10d51d 100644 --- a/.github/action-website/Dockerfile +++ b/.github/action-website/Dockerfile @@ -19,6 +19,7 @@ RUN set -ex \ libx11-xcb1 \ libxss1 \ libxtst6 \ + jq \ && rm -rf /var/lib/apt/lists/* ADD publish /usr/local/bin diff --git a/.github/action-website/publish b/.github/action-website/publish index 5a37be3..0572cf6 100755 --- a/.github/action-website/publish +++ b/.github/action-website/publish @@ -1,13 +1,27 @@ #!/bin/bash + +case "$1" in + staging) + DEST_DIR=. + ;; + preview) + DEST_DIR=PR-$(jq .number $GITHUB_EVENT_PATH) + ;; + *) + echo "Usage: $0 (staging|preview)" + exit 1 +esac + set -euxo pipefail -mkdir -p deploy/staging -cd deploy/staging +PUBLISH_DIR=$(mktemp -d /tmp/publish.XXXXXXXX) +cd $PUBLISH_DIR git clone -b asf-site https://github.com/apache/camel-website.git . git config user.email d...@camel.apache.org git config user.name $GITHUB_ACTOR +cd $DEST_DIR git rm -r * cp -R $GITHUB_WORKSPACE/public/* . git add . diff --git a/.github/main.workflow b/.github/main.workflow index 5cb5ba8..3ec0ad4 100644 --- a/.github/main.workflow +++ b/.github/main.workflow @@ -1,6 +1,9 @@ workflow "Build and publish the website" { on = "push" - resolves = ["Publish to staging"] + resolves = [ + "Publish to staging", + "Publish preview", + ] } action "Build theme" { @@ -26,5 +29,21 @@ action "Publish to staging" { uses = "./.github/action-website" needs = ["Filter on master branch"] runs = "publish" + args = "staging" secrets = ["GITHUB_TOKEN"] } + +action "Filter on pull request" { + uses = "actions/bin/filter@d820d56839906464fb7a57d1b4e1741cf5183efa" + needs = ["Build website"] + args = "ref refs/pulls/*" +} + +action "Publish preview" { + uses = "./.github/action-website" + needs = ["Filter on pull request"] + runs = "publish" + args = "preview" + secrets = ["GITHUB_TOKEN"] +} +