You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by zr...@apache.org on 2019/04/17 19:22:48 UTC

[camel-website] branch pr/deployment updated (cf3c5b6 -> 3d1ecf4)

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

zregvart pushed a change to branch pr/deployment
in repository https://gitbox.apache.org/repos/asf/camel-website.git.


 discard cf3c5b6  chore: GitHub deployments
     new 3d1ecf4  chore: GitHub deployments

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (cf3c5b6)
            \
             N -- N -- N   refs/heads/pr/deployment (3d1ecf4)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .github/action-website/publish | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)


[camel-website] 01/01: chore: GitHub deployments

Posted by zr...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

zregvart pushed a commit to branch pr/deployment
in repository https://gitbox.apache.org/repos/asf/camel-website.git

commit 3d1ecf40f6f3d2d6f1c8d1b59c62cbdb0d239d0b
Author: Zoran Regvart <zr...@apache.org>
AuthorDate: Sun Mar 3 16:19:37 2019 +0100

    chore: GitHub deployments
    
    Creates a GitHub deployment for previews and staging environment.
---
 .github/action-website/publish | 43 +++++++++++++++++++++++++++++++++++++++---
 .github/main.workflow          | 14 +++-----------
 2 files changed, 43 insertions(+), 14 deletions(-)

diff --git a/.github/action-website/publish b/.github/action-website/publish
index fa7cacf..9a8cf2e 100755
--- a/.github/action-website/publish
+++ b/.github/action-website/publish
@@ -2,17 +2,54 @@
 
 set -euxo pipefail
 
-REV=$(cd "$GITHUB_WORKSPACE" && git rev-parse --short HEAD)
+IS_PULL_REQUEST=$(jq -r .issue.pull_request $GITHUB_EVENT_PATH)
+REF=$(jq -r .ref $GITHUB_EVENT_PATH)
+ENVIRONMENT="preview"
+TRANSIENT="true"
+REV=$(git rev-parse HEAD)
+
+if [[ "$IS_PULL_REQUEST" != "null" ]]; then
+    DEST_DIR="preview/PR/$(jq .issue.number $GITHUB_EVENT_PATH)"
+elif [[ "$REF" != "ref/heads/master" ]]; then
+    DEST_DIR="preview/branch/${REF##*/}"
+else
+    DEST_DIR=.
+    ENVIRONMENT="staging"
+    TRANSIENT="false"
+fi
 
 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 dev@camel.apache.org
-git config user.name "$GITHUB_ACTOR"
+git config user.name $GITHUB_ACTOR
+mkdir -p $DEST_DIR
+cd $DEST_DIR
 git rm -r --ignore-unmatch *
-cp -Rvn "${GITHUB_WORKSPACE}/public/"* .
+cp -Rvn $GITHUB_WORKSPACE/public/* .
 git add .
 git commit -m "Website updated to ${REV}"
 git push origin asf-site
 
+URI=https://api.github.com
+API_HEADER="Accept: application/vnd.github.ant-man-preview+json"
+AUTH_HEADER="Authorization: token ${GITHUB_TOKEN}"
+
+! IFS='' read -r -d '' DEPLOYMENT_JSON << EOF
+{
+  "ref": "${REV}",
+  "auto_merge": false,
+  "environment": "${ENVIRONMENT}"
+  "description": "Website built and deployed to ${ENVIRONMENT} environment",
+  "transient": ${TRANSIENT},
+  "payload": "https://apache.camel.com/staging/${DEST_DIR}",
+  "description": "Deploy request from ${GITHUB_ACTOR}"
+}
+EOF
+
+curl -XPOST -sSL \
+    -H "${AUTH_HEADER}" \
+    -H "${API_HEADER}" \
+    -d "${DEPLOYMENT_JSON}" \
+    "${URI}/repos/apache/camel-website/deployments"
diff --git a/.github/main.workflow b/.github/main.workflow
index e0360e5..7bdd9c1 100644
--- a/.github/main.workflow
+++ b/.github/main.workflow
@@ -5,26 +5,18 @@ workflow "Build and publish the website" {
 
 action "Build theme" {
   uses = "./.github/action-website"
-  runs = "yarn"
-  args = "--non-interactive --frozen-lockfile --cwd antora-ui-camel"
+  runs = ["sh", "-c", "yarn --non-interactive --frozen-lockfile --cwd antora-ui-camel install && yarn --non-interactive --frozen-lockfile --cwd antora-ui-camel build"]
 }
 
 action "Build website" {
   uses = "./.github/action-website"
   needs = ["Build theme"]
-  runs = "yarn"
-  args = "--non-interactive --frozen-lockfile"
-}
-
-action "On master branch" {
-  uses = "actions/bin/filter@d820d56839906464fb7a57d1b4e1741cf5183efa"
-  needs = ["Build website"]
-  args = "branch master"
+  runs = ["sh", "-c", "yarn --non-interactive --frozen-lockfile install && yarn --non-interactive --frozen-lockfile build"]
 }
 
 action "Publish" {
   uses = "./.github/action-website"
-  needs = ["On master branch"]
+  needs = ["Build website"]
   runs = "publish"
   secrets = ["GITHUB_TOKEN"]
 }