From 132b4aae36f8d9347215447ce581938c171f154b Mon Sep 17 00:00:00 2001
From: Benoit Lavenier <benoit.lavenier@e-is.pro>
Date: Fri, 6 Mar 2020 17:34:29 +0100
Subject: [PATCH] [fix] Release: Fix extension sign return (do not exist when
 submit failed, because it's a normal exit status) [enh] Release: allow to
 exclude windows asset, when building desktop

---
 doc/feed/feed-fr.json                               | 2 +-
 hooks/after_prepare/050_clean_unused_directories.js | 1 +
 platforms/android                                   | 2 +-
 scripts/release-desktop.sh                          | 8 ++++++++
 scripts/release-sign-extension.sh                   | 4 +++-
 scripts/release-to-github.sh                        | 4 ++--
 scripts/release.sh                                  | 4 ++++
 7 files changed, 20 insertions(+), 5 deletions(-)

diff --git a/doc/feed/feed-fr.json b/doc/feed/feed-fr.json
index 91288145..1d3119d7 100644
--- a/doc/feed/feed-fr.json
+++ b/doc/feed/feed-fr.json
@@ -29,7 +29,7 @@
       "id": "https://cesium.app",
       "url": "https://cesium.app",
       "image": "https://cesium.app/i18n/fr_FR/contents/accueil/Cesium-G1-maquette.png",
-      "content_html": "<p><ul><li>Vous aimeriez vous inscrire à la Ğ1 (<i>June</i>), mais vous ne savez pas comment vous y prendre ?</li><li>Vous voulez savoir <b>comment utiliser</b> Cesium depuis votre smartphone ou ordinateur ?</li><li>On vous a dit que Cesium faisait aussi le café (en plus de gérer votre portefeuille en monnaie libre), mais vous n'en êtes pas sûr ? :-)</li></ul></p><p>Tutos, téléchargements, documentation: tout est désormais accessible depuis le <b>site officiel</b> : <b>https://cesium.app</b> !</p>"
+      "content_html": "<p><ul><li>Vous aimeriez vous inscrire à la Ğ1 (<i>June</i>), mais vous ne savez pas comment vous y prendre ?</li><li>Vous voulez savoir <b>comment utiliser</b> Cesium depuis votre smartphone ou ordinateur ?</li><li>On vous a dit que Cesium faisait aussi le café (en plus de gérer votre portefeuille en monnaie libre), mais vous n'en êtes pas sûr ? :-)</li></ul></p><p>Tutos, téléchargements, documentation: tout est désormais accessible depuis le <b>site officiel</b> : <a href=\"https://cesium.app\">https://cesium.app</a> !</p>"
     }
   ]
 }
diff --git a/hooks/after_prepare/050_clean_unused_directories.js b/hooks/after_prepare/050_clean_unused_directories.js
index d1c9f28c..8e0b1c37 100755
--- a/hooks/after_prepare/050_clean_unused_directories.js
+++ b/hooks/after_prepare/050_clean_unused_directories.js
@@ -33,6 +33,7 @@ if (rootdir && !skip) {
 
     // Clean unused directories
     del.sync([
+      path.join(wwwPath, 'api'),
       path.join(wwwPath, 'i18n'),
       path.join(wwwPath, 'js'),
       path.join(wwwPath, 'templates'),
diff --git a/platforms/android b/platforms/android
index 1b4d4beb..43173695 160000
--- a/platforms/android
+++ b/platforms/android
@@ -1 +1 @@
-Subproject commit 1b4d4bebcd8deb806afb9abcdf296d0f3a76025e
+Subproject commit 43173695faa4d60229b1a6bc6f1bc11d1c262627
diff --git a/scripts/release-desktop.sh b/scripts/release-desktop.sh
index 5d6b1a0f..c5840529 100755
--- a/scripts/release-desktop.sh
+++ b/scripts/release-desktop.sh
@@ -54,6 +54,14 @@ cd "${PROJECT_DIR}/dist/desktop"
 # Fetch last updates
 git fetch origin && git merge origin/master || exit 1
 
+### Skip windows assets (workaround because it often failed)
+if [[ "${DESKTOP_ASSETS}" == "linux" ]]; then
+
+  echo "Skipping windows assets, because DESKTOP_ASSETS env was set to 'linux'."
+  EXPECTED_ASSETS="${PROJECT_NAME}-desktop-v$current-linux-x64.deb
+${PROJECT_NAME}-desktop-v$current-linux-x64.tar.gz"
+fi
+
 # Build desktop assets
 ./release.sh $current
 if [[ $? -ne 0 ]]; then
diff --git a/scripts/release-sign-extension.sh b/scripts/release-sign-extension.sh
index 07d4fa57..9987add3 100755
--- a/scripts/release-sign-extension.sh
+++ b/scripts/release-sign-extension.sh
@@ -46,7 +46,9 @@ case "$1" in
   rel)
     web-ext sign "--api-key=${AMO_JWT_ISSUER}" "--api-secret=${AMO_JWT_SECRET}" "--source-dir=${PROJECT_DIR}/dist/web/ext" "--artifacts-dir=${PROJECT_DIR}/dist/web/build"  --id=${WEB_EXT_ID} --channel=listed
     if [[ $? -ne 0 ]]; then
-      exit 1
+      # Comment out, because always failed with message:
+      #   "Your add-on has been submitted for review. It passed validation but could not be automatically signed because this is a listed add-on."
+      #exit 1
     fi
     ;;
   *)
diff --git a/scripts/release-to-github.sh b/scripts/release-to-github.sh
index 4cb47ce1..88f19c40 100755
--- a/scripts/release-to-github.sh
+++ b/scripts/release-to-github.sh
@@ -119,7 +119,7 @@ fi
 # Upload web extension (ZIP) file
 WEB_EXT_ZIP_BASENAME="${PROJECT_NAME}-v$current-extension.zip"
 WEB_EXT_ZIP_FILE="${DIST_WEB}/${WEB_EXT_ZIP_BASENAME}"
-if [[ -f "${WEB_EXT_FILE}" ]]; then
+if [[ -f "${WEB_EXT_ZIP_FILE}" ]]; then
   result=$(curl -s -H ''"$GITHUT_AUTH"'' -H 'Content-Type: application/zip' -T "${WEB_EXT_ZIP_FILE}" "${upload_url}?name=${WEB_EXT_ZIP_BASENAME}")
   browser_download_url=$(echo "$result" | grep -P "\"browser_download_url\":[ ]?\"[^\"]+" | grep -oP "\"browser_download_url\":[ ]?\"[^\"]+"  | grep -oP "https://[A-Za-z0-9/.-]+")
   WEB_EXT_ZIP_SHA256=$(cd ${DIST_WEB} && sha256sum "${WEB_EXT_ZIP_BASENAME}")
@@ -157,8 +157,8 @@ SHA_BASENAME=${PROJECT_NAME}-v$current.sha256
 SHA_FILE=${PROJECT_DIR}/dist/${SHA_BASENAME}
 echo "${WEB_SHA256}" > ${SHA_FILE}
 echo "${WEB_EXT_ZIP_SHA256}" >> ${SHA_FILE}
-echo "${WEB_EXT_XPI_SHA256}" >> ${SHA_FILE}
 echo "${APK_SHA256}" >> ${SHA_FILE}
+echo "${WEB_EXT_XPI_SHA256}" >> ${SHA_FILE}
 result=$(curl -s -H ''"$GITHUT_AUTH"'' -H 'Content-Type: text/plain' -T "${SHA_FILE}" "${upload_url}?name=${SHA_BASENAME}")
 
 ### Success message
diff --git a/scripts/release.sh b/scripts/release.sh
index e6d1088e..8ef9cbbc 100755
--- a/scripts/release.sh
+++ b/scripts/release.sh
@@ -110,11 +110,15 @@ echo "----------------------------------"
 echo "- Building web and extension artifacts..."
 echo "----------------------------------"
 cd ${PROJECT_DIR} || exit 1
+
+# Run web build
 gulp config --env default
 gulp webBuild --release
 if [[ $? -ne 0 ]]; then
   exit 1
 fi
+
+# check files exists
 DIST_WEB_FILE="${DIST_WEB}/${PROJECT_NAME}-v$2-web.zip"
 if [[ ! -f "${DIST_WEB_FILE}" ]]; then
   echo "ERROR: Missing web artifact at ${DIST_WEB_FILE}"
-- 
GitLab