From 3603a225e16afcd82908adadbb46f089a2e94968 Mon Sep 17 00:00:00 2001 From: Benoit Lavenier <benoit.lavenier@e-is.pro> Date: Fri, 3 Jan 2020 22:09:09 +0100 Subject: [PATCH] [fix] Fix github upload to send sha256 checksum file --- config.xml | 2 +- hooks/after_prepare/010_add_platform_class.js | 16 ++++++++-------- .../050_clean_unused_directories.js | 4 ++-- scripts/github.sh | 9 ++++++++- 4 files changed, 19 insertions(+), 12 deletions(-) diff --git a/config.xml b/config.xml index c0056aea..d8dbfadd 100644 --- a/config.xml +++ b/config.xml @@ -1,5 +1,5 @@ <?xml version='1.0' encoding='utf-8'?> -<widget android-versionCode="104018" id="fr.duniter.cesium" ios-CFBundleIdentifier="org.duniter.cesium" version="1.4.18" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0"> +<widget android-versionCode="104019" id="fr.duniter.cesium" ios-CFBundleIdentifier="org.duniter.cesium" version="1.4.19" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0"> <name>Cesium</name> <description> An simple App for Duniter wallet diff --git a/hooks/after_prepare/010_add_platform_class.js b/hooks/after_prepare/010_add_platform_class.js index e1cf1cf0..73302b26 100755 --- a/hooks/after_prepare/010_add_platform_class.js +++ b/hooks/after_prepare/010_add_platform_class.js @@ -26,13 +26,13 @@ function addPlatformBodyTag(indexPath, platform) { if(bodyTag.indexOf(platformClass) > -1) return; // already added - var newBodyTag = bodyTag; + let newBodyTag = bodyTag; - var classAttr = findClassAttr(bodyTag); + let classAttr = findClassAttr(bodyTag); if(classAttr) { // body tag has existing class attribute, add the classname - var endingQuote = classAttr.substring(classAttr.length-1); - var newClassAttr = classAttr.substring(0, classAttr.length-1); + let endingQuote = classAttr.substring(classAttr.length-1); + let newClassAttr = classAttr.substring(0, classAttr.length-1); newClassAttr += ' ' + platformClass + ' ' + cordovaClass + endingQuote; newBodyTag = bodyTag.replace(classAttr, newClassAttr); @@ -68,13 +68,13 @@ function findClassAttr(bodyTag) { if (rootdir) { // go through each of the platform directories that have been prepared - var platforms = (process.env.CORDOVA_PLATFORMS ? process.env.CORDOVA_PLATFORMS.split(',') : []); + const platforms = (process.env.CORDOVA_PLATFORMS ? process.env.CORDOVA_PLATFORMS.split(',') : []); - for(var x=0; x<platforms.length; x++) { + for(let x=0; x<platforms.length; x++) { // open up the index.html file at the www root try { - var platform = platforms[x].trim().toLowerCase(); - var indexPath; + const platform = platforms[x].trim().toLowerCase(); + let indexPath; if(platform == 'android') { indexPath = path.join('platforms', platform, 'assets', 'www', 'index.html'); diff --git a/hooks/after_prepare/050_clean_unused_directories.js b/hooks/after_prepare/050_clean_unused_directories.js index 3c863d71..d1c9f28c 100755 --- a/hooks/after_prepare/050_clean_unused_directories.js +++ b/hooks/after_prepare/050_clean_unused_directories.js @@ -9,7 +9,7 @@ const rootdir = process.argv[2]; let skip = true; if (cmd.indexOf("--release") > -1 || cmd.indexOf("--useref") > -1) { - skip = false; + skip = false; } if (rootdir && !skip) { @@ -55,7 +55,7 @@ if (rootdir && !skip) { // ...and keep Robotodraft fonts directory '!'+path.join(wwwPath, 'lib', 'robotdraft'), path.join(wwwPath, 'lib', 'robotdraft', '*'), - '!'+path.join(wwwPath, 'lib', 'robotdraft', 'fonts'), + '!'+path.join(wwwPath, 'lib', 'robotdraft', 'fonts') ]); } } diff --git a/scripts/github.sh b/scripts/github.sh index 254df596..16597945 100755 --- a/scripts/github.sh +++ b/scripts/github.sh @@ -99,7 +99,7 @@ case "$1" in if [[ -f "${ZIP_FILE}" ]]; then result=$(curl -s -H ''"$GITHUT_AUTH"'' -H 'Content-Type: application/zip' -T "${ZIP_FILE}" "${upload_url}?name=${ZIP_BASENAME}") browser_download_url=$(echo "$result" | grep -P "\"browser_download_url\":[ ]?\"[^\"]+" | grep -oP "\"browser_download_url\":[ ]?\"[^\"]+" | grep -oP "https://[A-Za-z0-9/.-]+") - ZIP_SHA256=$(cd ${WEB_OUTPUT} && sha256sum "${PROJECT_NAME}-v${current}-web.zip") + ZIP_SHA256=$(cd ${DIST_WEB} && sha256sum "${ZIP_BASENAME}") echo " - ${browser_download_url} | Checksum: ${ZIP_SHA256}" else echo " - ERROR: Web release (ZIP) not found! Skipping." @@ -116,6 +116,13 @@ case "$1" in echo "- ERROR: Android release (APK) not found! Skipping." fi + # Send Checksum file + SHA_BASENAME=${PROJECT_NAME}-v$current.sha + SHA_FILE=${PROJECT_DIR}/dist/${SHA_BASENAME} + echo "${ZIP_SHA256}\n" > ${SHA_FILE} + echo "${APK_SHA256}\n" >> ${SHA_FILE} + result=$(curl -s -H ''"$GITHUT_AUTH"'' -H 'Content-Type: text/plain' -T "${SHA_FILE}" "${upload_url}?name=${SHA_BASENAME}") + echo "-----------------------------------------" echo "Successfully uploading files !" echo " -> Release url: ${REPO_PUBLIC_URL}/releases/tag/v${current}" -- GitLab