From 4dc2d68a345790a9fcdf2bcc2888fa98cf2a50bf Mon Sep 17 00:00:00 2001 From: "Joshua A. Horton" Date: Mon, 9 Jan 2023 11:52:04 +0700 Subject: [PATCH] feat(web): starts implementation of CI publish-s.keyman action --- web/build.sh | 2 +- web/ci.sh | 55 ++++++++++++++++++++++++++++++++++++++++++++++++---- 2 files changed, 52 insertions(+), 5 deletions(-) diff --git a/web/build.sh b/web/build.sh index c5dcc4df88..558fee2799 100755 --- a/web/build.sh +++ b/web/build.sh @@ -306,7 +306,7 @@ copy_sources ( ) { do echo "- $SOURCE/$SOURCE_FOLDER/ => $CONFIG_OUT_PATH/src/$SOURCE_FOLDER/" mkdir -p "$CONFIG_OUT_PATH/src/$SOURCE_FOLDER" - cp -Rf "$SOURCE/$SOURCE_FOLDER/" "$CONFIG_OUT_PATH/src/$SOURCE_FOLDER" + cp -Rf "$SOURCE/$SOURCE_FOLDER/"* "$CONFIG_OUT_PATH/src/$SOURCE_FOLDER/" done echo diff --git a/web/ci.sh b/web/ci.sh index 539d47f79f..05fb8294d0 100755 --- a/web/ci.sh +++ b/web/ci.sh @@ -24,10 +24,13 @@ cd "$THIS_SCRIPT_PATH" builder_describe "Defines and implements the CI build steps for Keyman Engine for Web (KMW)." \ "build" \ - "test Runs all unit tests." \ - "post-test Runs post-test cleanup. Should be run even if a prior step fails." \ - "validate-size Runs the build-size comparison check" \ - "--debug Runs this script in local-development mode; reports and tests will be locally logged" + "test Runs all unit tests." \ + "post-test Runs post-test cleanup. Should be run even if a prior step fails." \ + "validate-size Runs the build-size comparison check" \ + "publish-s.keyman Prepares an s.keyman.com PR (intended for release builds)" \ + "publish-downloads Prepares the upload to downloads.keyman.com (intended for release builds)" \ + "--debug Runs this script in local-development mode; reports and tests will be locally logged" \ + "--password=PASSWORD Used to supply passwords needed by certain actions" builder_parse "$@" @@ -83,4 +86,48 @@ if builder_start_action validate-size; then ./src/tools/building/check-build-size.sh $FLAGS builder_finish_action success validate-size +fi + +if builder_start_action publish-s.keyman; then + TIER=`cat ../TIER.md` + BUILD_NUMBER=`cat ../VERSION.md` + S_KEYMAN_COM=../../s.keyman.com + + # First phase: make sure the s.keyman.com repo is locally-available and up to date. + pushd "$S_KEYMAN_COM" + if builder_has_option --password; then + git pull https://keyman-server:$PASSWORD@github.com/keymanapp/s.keyman.com.git master + else + # For testing on a local development machine / a machine with the repo already loaded. + git checkout master + git pull + fi + popd + + # Second phase: copy the artifacts over + + # The main build products are expected to reside at the root of this folder. + BASE_PUBLISH_FOLDER="$S_KEYMAN_COM/kmw/engine/$BUILD_NUMBER" + mkdir "$BASE_PUBLISH_FOLDER" + + cp -Rf build/app/web/release/* "$BASE_PUBLISH_FOLDER" + cp -Rf build/app/ui/release/* "$BASE_PUBLISH_FOLDER" + + # Third phase: tweak the sourcemaps + # TODO: actual sourcemap tweaking. + + # Final phase: build the PR and push it. + cd "$S_KEYMAN_COM" + # git config user.name "Keyman Build Server" + # git config user.email "keyman-server@users.noreply.github.com" + git add "kmw/engine/$BUILD_NUMBER" + # git commit -m "KeymanWeb release $BUILD_NUMBER (automatic)" + # git push https://keyman-server:$PASSWORD@github.com/keymanapp/s.keyman.com.git master + + builder_finish_action success publish-s.keyman +fi + +if builder_start_action publish-downloads; then +# + builder_finish_action success publish-downloads fi \ No newline at end of file