From de6b4dcc3e0eacbd828ecd5ec046ca092c4af2ee Mon Sep 17 00:00:00 2001 From: Brandon Patterson Date: Tue, 2 Apr 2024 10:35:43 -0400 Subject: [PATCH] adding json build --- bin/build-version-json.sh | 14 ++++++++++++++ bin/gcs-deploy.sh | 4 +++- 2 files changed, 17 insertions(+), 1 deletion(-) create mode 100755 bin/build-version-json.sh diff --git a/bin/build-version-json.sh b/bin/build-version-json.sh new file mode 100755 index 000000000..3785e1545 --- /dev/null +++ b/bin/build-version-json.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +echo "$(dirname $0)" +cd $(dirname $0)/.. + +HASH=$(git --no-pager log --format=format:"%H" -1) +TAG=$(git describe --tags) + +printf '{"commit":"%s","version":"%s","source":"https://github.com/mozilla/extension-workshop"}\n' \ + "$HASH" \ + "$TAG" \ + > version.json + +cat version.json diff --git a/bin/gcs-deploy.sh b/bin/gcs-deploy.sh index 176605648..f744176f0 100644 --- a/bin/gcs-deploy.sh +++ b/bin/gcs-deploy.sh @@ -15,11 +15,13 @@ set -ex CSPSTATIC="x-goog-meta-content-security-policy: default-src 'none'; base-uri 'none'; form-action 'none'; frame-ancestors: 'none'; object-src 'none'" CSP="x-goog-meta-content-security-policy: default-src 'none'; img-src 'self' data:; form-action 'self' https://www.mozilla.org/en-US/newsletter/; media-src 'self' blob:; script-src 'self' https://www.youtube.com/iframe_api https://www.youtube.com/s/player/ 'sha256-vqFvYKh0rwFP9fSa0PuzUff2ElHQ+rkjGfycqUNqufQ=' https://www.googletagmanager.com/gtag/js ; font-src 'self'; frame-ancestors 'none'; frame-src https://www.youtube.com/embed/ https://calendar.google.com/calendar/appointments/; base-uri 'none'; style-src 'self' 'unsafe-inline'; connect-src 'self' https://blog.mozilla.org/addons/feed/ https://www.mozilla.org/en-US/newsletter/ https://*.google-analytics.com;" ACAO="x-goog-meta-access-control-allow-origin: *" + if [ -z "$EXTENSION_WORKSHOP_BUCKET_GCS" ]; then echo "The GCS bucket is not set. Failing." exit 1 fi - + +[ -e version.json ] || $(dirname $0)/build-version-json.sh if [ -e version.json ]; then mv version.json dist/__version__