Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

jkv/build docs copy to shopify dev if dir exists #1708

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 9 additions & 11 deletions packages/ui-extensions/docs/surfaces/checkout/build-docs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,27 +40,25 @@ if [ $sed_exit -ne 0 ]; then
fail_and_exit $sed_exit
fi

if [ -n "$SPIN" ]; then
if [ -n "$SPIN_SHOPIFY_DEV_SERVICE_FQDN" ]; then

mkdir -p ~/src/github.com/Shopify/shopify-dev/db/data/docs/templated_apis/checkout_extensions/$API_VERSION
cp ./$DOCS_PATH/generated/* ~/src/github.com/Shopify/shopify-dev/db/data/docs/templated_apis/checkout_extensions/$API_VERSION
# Copy the generated docs to shopify-dev
if [ -d ../../../shopify-dev ]; then
mkdir -p ../../../shopify-dev/db/data/docs/templated_apis/checkout_extensions/$API_VERSION
cp ./$DOCS_PATH/generated/* ../../../shopify-dev/db/data/docs/templated_apis/checkout_extensions/$API_VERSION
# Replace 'unstable' with the exact API version in relative doc links
sed -i \
"s/\/docs\/api\/checkout-ui-extensions\/unstable/\/docs\/api\/checkout-ui-extensions\/$API_VERSION/gi" \
~/src/github.com/Shopify/shopify-dev/db/data/docs/templated_apis/checkout_extensions/$API_VERSION/generated_docs_data.json
../../../shopify-dev/db/data/docs/templated_apis/checkout_extensions/$API_VERSION/generated_docs_data.json
sed_exit=$?
if [ $sed_exit -ne 0 ]; then
fail_and_exit $sed_exit
fi
rsync -a --delete ./$DOCS_PATH/screenshots/ ~/src/github.com/Shopify/shopify-dev/app/assets/images/templated-apis-screenshots/checkout-ui-extensions/$API_VERSION

cd ~/src/github.com/Shopify/shopify-dev
rsync -a --delete ./$DOCS_PATH/screenshots/ ../../../shopify-dev/app/assets/images/templated-apis-screenshots/checkout-ui-extensions/$API_VERSION

if [ -n "$SPIN_SHOPIFY_DEV_SERVICE_FQDN" ]; then
echo "Docs: https://$SPIN_SHOPIFY_DEV_SERVICE_FQDN/docs/api/checkout-ui-extensions"
else
echo "If you include shopify-dev in your Spin constellation, this will automatically copy ./$DOCS_PATH/generated to shopify-dev"
echo "If you include shopify-dev in your Spin constellation, we can generate a preview link for the docs!"
fi
else
echo "Not copying docs to shopify-dev because we're not in Spin"
echo "Not copying docs to shopify-dev because it was not found at ../../../shopify-dev."
fi
Loading