From 58788acf0b7ccf950c634a7dea3ae9fca0318013 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Albert=20Juh=C3=A9=20Lluveras?= Date: Mon, 24 Aug 2020 10:27:58 +0200 Subject: [PATCH] Exclude storybook from released ZIP (https://github.com/woocommerce/woocommerce-blocks/pull/3036) * Create copy plugin files bash script so logic is not duplicated * Exclude storybook from ZIP. Fixes woocommerce/woocommerce-blocks#2671 --- .../bin/build-plugin-zip.sh | 37 +------------------ .../bin/copy-plugin-files.sh | 29 +++++++++++++++ .../bin/wordpress-deploy.sh | 34 +---------------- 3 files changed, 33 insertions(+), 67 deletions(-) create mode 100644 plugins/woocommerce-blocks/bin/copy-plugin-files.sh diff --git a/plugins/woocommerce-blocks/bin/build-plugin-zip.sh b/plugins/woocommerce-blocks/bin/build-plugin-zip.sh index 94d31532c3c..df197039c61 100755 --- a/plugins/woocommerce-blocks/bin/build-plugin-zip.sh +++ b/plugins/woocommerce-blocks/bin/build-plugin-zip.sh @@ -60,39 +60,6 @@ warning () { echo -e "\n${YELLOW_BOLD}$1${COLOR_RESET}\n" } -copy_dest_files() { - CURRENT_DIR=$(pwd) - cd "$1" || exit - rsync ./ "$2"/ --recursive --delete --delete-excluded \ - --exclude=".*/" \ - --exclude="*.md" \ - --exclude=".*" \ - --exclude="composer.*" \ - --exclude="*.lock" \ - --exclude=bin/ \ - --exclude=node_modules/ \ - --exclude=tests/ \ - --exclude=docs/ \ - --exclude=phpcs.xml \ - --exclude=phpunit.xml.dist \ - --exclude=CODEOWNERS \ - --exclude=renovate.json \ - --exclude="*.config.js" \ - --exclude="*-config.js" \ - --exclude="*.config.json" \ - --exclude=package.json \ - --exclude=package-lock.json \ - --exclude=none \ - --exclude=blocks.ini \ - --exclude=docker-compose.yml \ - --exclude=tsconfig.json \ - --exclude=woocommerce-gutenberg-products-block.zip \ - --exclude="zip-file/" \ - --exclude=globals.d.ts - status "Done copying files!" - cd "$CURRENT_DIR" || exit -} - status "💃 Time to build a WooCommerce Blocks ZIP 🕺" if [ -z "$NO_CHECKS" ]; then @@ -145,8 +112,8 @@ fi status "Creating archive... 🎁" mkdir zip-file mkdir zip-file/build -copy_dest_files $SOURCE_PATH "$SOURCE_PATH/zip-file" -cd zip-file +sh $SOURCE_PATH/bin/copy-plugin-files.sh $SOURCE_PATH "$SOURCE_PATH/zip-file" +cd $(pwd)/zip-file zip -r ../woocommerce-gutenberg-products-block.zip ./ cd .. rm -r zip-file diff --git a/plugins/woocommerce-blocks/bin/copy-plugin-files.sh b/plugins/woocommerce-blocks/bin/copy-plugin-files.sh new file mode 100644 index 00000000000..940286cf84e --- /dev/null +++ b/plugins/woocommerce-blocks/bin/copy-plugin-files.sh @@ -0,0 +1,29 @@ +cd "$1" || exit +rsync ./ "$2"/ --recursive --delete --delete-excluded \ + --exclude=".*/" \ + --exclude="*.md" \ + --exclude=".*" \ + --exclude="composer.*" \ + --exclude="*.lock" \ + --exclude=bin/ \ + --exclude=node_modules/ \ + --exclude=tests/ \ + --exclude=docs/ \ + --exclude=phpcs.xml \ + --exclude=phpunit.xml.dist \ + --exclude=CODEOWNERS \ + --exclude=renovate.json \ + --exclude="*.config.js" \ + --exclude="*-config.js" \ + --exclude="*.config.json" \ + --exclude=package.json \ + --exclude=package-lock.json \ + --exclude=none \ + --exclude=blocks.ini \ + --exclude=docker-compose.yml \ + --exclude=tsconfig.json \ + --exclude=woocommerce-gutenberg-products-block.zip \ + --exclude="zip-file/" \ + --exclude=globals.d.ts \ + --exclude=storybook/ +echo -e "\nDone copying files!\n" diff --git a/plugins/woocommerce-blocks/bin/wordpress-deploy.sh b/plugins/woocommerce-blocks/bin/wordpress-deploy.sh index 3079033d388..28142345559 100644 --- a/plugins/woocommerce-blocks/bin/wordpress-deploy.sh +++ b/plugins/woocommerce-blocks/bin/wordpress-deploy.sh @@ -40,37 +40,6 @@ output_list() { echo "$(tput setaf "$1") • $2:$(tput sgr0) \"$3\"" } -# Sync dest files -copy_dest_files() { - cd "$2" || exit - rsync ./ "$3"/"$1"/ --recursive --delete --delete-excluded \ - --exclude=".*/" \ - --exclude="*.md" \ - --exclude=".*" \ - --exclude="composer.*" \ - --exclude="*.lock" \ - --exclude=bin/ \ - --exclude=node_modules/ \ - --exclude=tests/ \ - --exclude=docs/ \ - --exclude=phpcs.xml \ - --exclude=phpunit.xml.dist \ - --exclude=CODEOWNERS \ - --exclude=renovate.json \ - --exclude="*.config.js" \ - --exclude="*-config.js" \ - --exclude="*.config.json" \ - --exclude=package.json \ - --exclude=package-lock.json \ - --exclude=none \ - --exclude=blocks.ini \ - --exclude=docker-compose.yml \ - --exclude=tsconfig.json \ - --exclude=globals.d.ts - output 2 "Done copying files!" - cd "$3" || exit -} - # Release script echo output 4 "BLOCKS->WordPress.org RELEASE SCRIPT" @@ -173,7 +142,8 @@ fi # Copy GIT directory to trunk output 2 "Copying project files to SVN trunk..." -copy_dest_files "trunk" "$GIT_PATH" "$SVN_PATH" +sh ${RELEASER_PATH}/bin/copy-plugin-files.sh "$GIT_PATH" "$SVN_PATH/trunk" +cd "$SVN_PATH" # Update stable tag on trunk/readme.txt if [ $IS_PRE_RELEASE = false ]; then