From 9abd9921a73d4f4d06db7b6d85b26c7498722047 Mon Sep 17 00:00:00 2001 From: Erin Schnabel Date: Thu, 4 Aug 2022 14:35:26 -0400 Subject: [PATCH] docs: update web sync script --- .gitignore | 1 + docs/sync-web-site.sh | 42 ++++++++++++++++++++++++++++++++++++------ 2 files changed, 37 insertions(+), 6 deletions(-) diff --git a/.gitignore b/.gitignore index bcf6f3fd6fe36..de46fd65f73ec 100644 --- a/.gitignore +++ b/.gitignore @@ -40,3 +40,4 @@ nb-configuration.xml .jbang .sdkmanrc .envrc +.jekyll-cache diff --git a/docs/sync-web-site.sh b/docs/sync-web-site.sh index 468f957646e6d..429ee82a40917 100755 --- a/docs/sync-web-site.sh +++ b/docs/sync-web-site.sh @@ -1,29 +1,59 @@ #!/usr/bin/env bash -git clone -b develop --single-branch git@github.com:quarkusio/quarkusio.github.io.git target/web-site +# Make sure our working directory is where this script lives (docs directory of quarkus) +SCRIPTDIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) +cd "${SCRIPTDIR}" + +# Invocation for sync + publish for a release +# This will clone the website and then sync documents to the 'latest' for a release +# +# $ QUARKUS_WEB_SITE_PUSH=true QUARKUS_RELEASE=true ./sync-web-site.sh ${BRANCH} +# +# In quarkusio/quarkusio.github.io repo for nightly sync (.github/workflows/sync-main-doc.yml) +# Both the branch and the target website directory are specified. +# This will skip the website repo clone and will sync files into _versions, _generated_config, etc. +# +# $ .quarkus-main-repository/docs/sync-web-site.sh main ${PWD} +# +# For local development leave all arguments out. +# This will clone the website repo clone and sync files into _versions, _generated_config, etc. +# (use the version dropdown to select the nightly snapshot to preview changes) +# +# $ ./sync-web-site.sh if [ $# -eq 0 ]; then BRANCH="main" else BRANCH=$1 fi +if [ $# -ge 2 ]; then + TARGET_DIR=$2 +fi + +if [ -z $TARGET_DIR ]; then + TARGET_DIR=target/web-site + git clone -b develop --single-branch git@github.com:quarkusio/quarkusio.github.io.git ${TARGET_DIR} +fi -if [[ $BRANCH == "main" ]]; then - TARGET_GUIDES=target/web-site/_guides - TARGET_CONFIG=target/web-site/_generated-config/latest +if [ $BRANCH == "main" ] && [ "$QUARKUS_RELEASE" == "true" ]; then + TARGET_GUIDES=${TARGET_DIR}/_guides + TARGET_CONFIG=${TARGET_DIR}/_generated-config/latest else - TARGET_GUIDES=target/web-site/_versions/${BRANCH}/guides - TARGET_CONFIG=target/web-site/_generated-config/${BRANCH} + TARGET_GUIDES=${TARGET_DIR}/_versions/${BRANCH}/guides + TARGET_CONFIG=${TARGET_DIR}/_generated-config/${BRANCH} fi +echo "Copying from src/main/asciidoc/* to $TARGET_GUIDES" rsync -vr --delete \ --exclude='**/*.html' \ --exclude='**/index.adoc' \ --exclude='**/attributes.adoc' \ --exclude='**/guides.md' \ + --exclude='**/_templates' \ src/main/asciidoc/* \ $TARGET_GUIDES +echo "\nCopying from ../target/asciidoc/generated/ to $TARGET_CONFIG" rsync -vr --delete \ --exclude='**/*.html' \ --exclude='**/index.adoc' \