Skip to content
Snippets Groups Projects
Commit 7ff97638 authored by Benoit Lavenier's avatar Benoit Lavenier
Browse files

[enh] Build as webExtension (.xpi) file

parent 5d3ec9ab
No related branches found
No related tags found
No related merge requests found
......@@ -629,22 +629,26 @@ function webExtCopyFiles() {
const resourcesPath = './resources/web-ext';
return gulp.src([
wwwPath + '/**/*',
wwwPath + '/dist_js/*.*',
// Remove debug JS files
// Remove JS debug files
wwwPath + '/dist_js/*.*',
'!' + wwwPath + '/dist_js/cesium.js',
'!' + wwwPath + '/dist_js/vendor.js',
'!' + wwwPath + '/dist_js/cesium-api*.js',
'!' + wwwPath + '/dist_js/vendor-api*.js',
'!' + wwwPath + '/dist_js/cesium-api.js',
'!' + wwwPath + '/dist_js/vendor-api.js',
// Remove CSS debug files
wwwPath + '/dist_css/*.*',
// Remove debug CSS files
'!' + wwwPath + '/dist_css/cesium.css',
'!' + wwwPath + '/dist_css/cesium-api*.css',
// Remove HTML debug files
wwwPath + '/api/*',
'!' + wwwPath + '/api/debug.html',
'!' + wwwPath + '/debug.html',
'!' + wwwPath + '/manifest.json',
// Add specific resource
// Add specific resource (and overwrite the default 'manifest.json')
'!' + wwwPath + '/manifest.json',
resourcesPath + '/**/*.*'
])
......
......@@ -61,6 +61,10 @@ case "$1" in
currentManifestJsonVersion=$(grep -oP "version\": \"\d+.\d+.\d+((a|b)[0-9]+)?\"" www/manifest.json | grep -oP "\d+.\d+.\d+((a|b)[0-9]+)?")
sed -i "s/version\": \"$currentManifestJsonVersion\"/version\": \"$2\"/g" www/manifest.json
# Change version in file: 'resources/web-ext/manifest.json'
currentExtManifestJsonVersion=$(grep -oP "version\": \"\d+.\d+.\d+((a|b)[0-9]+)?\"" resources/web-ext/manifest.json | grep -oP "\d+.\d+.\d+((a|b)[0-9]+)?")
sed -i "s/version\": \"$currentExtManifestJsonVersion\"/version\": \"$2\"/g" resources/web-ext/manifest.json
# Bump the install.sh
sed -i "s/echo \"v.*\" #lastest/echo \"v$2\" #lastest/g" install.sh
;;
......@@ -103,7 +107,7 @@ cp ${APK_RELEASE_FILE} "${DIST_ANDROID}/${PROJECT_NAME}-v$2-android.apk" || exit
echo "----------------------------------"
echo "- Building web artifact..."
echo "- Building web and webExtension artifacts..."
echo "----------------------------------"
cd ${PROJECT_DIR} || exit 1
gulp config --env default
......@@ -116,6 +120,11 @@ if [[ ! -f "${DIST_WEB_FILE}" ]]; then
echo "ERROR: Missing web artifact at ${DIST_WEB_FILE}"
exit 1
fi;
DIST_WEB_EXT_FILE="${DIST_WEB}/${PROJECT_NAME}-v$2-extension.xpi"
if [[ ! -f "${DIST_WEB_EXT_FILE}" ]]; then
echo "ERROR: Missing web-ext artifact at ${DIST_WEB_EXT_FILE}"
exit 1
fi;
echo "----------------------------------"
echo "- Executing git push, with tag: v$2"
......@@ -128,7 +137,7 @@ fi
# Commit
cd ${PROJECT_DIR} || exit 1
git reset HEAD
git add package.json config.xml install.sh www/js/config.js www/manifest.json
git add package.json config.xml install.sh www/js/config.js www/manifest.json resources/web-ext/manifest.json
if [[ $? -ne 0 ]]; then
exit 1
fi
......@@ -156,6 +165,22 @@ if [[ $? -ne 0 ]]; then
exit 1
fi
echo "**********************************"
echo "* Upload web extension to Modzilla..."
echo "**********************************"
if [[ "_" == "_${AMO_JWT_ISSUER}" || "_" == "_${AMO_JWT_SECRET}" ]]; then
echo "WARN: Cannot send webExtension to Modzilla: missing env variable 'AMO_JWT_ISSUER' or 'AMO_JWT_SECRET'. Use local file './local/env.sh' to define it, then retry."
else
web-ext sign --api-key=${AMO_JWT_ISSUER} --api-secret=${AMO_JWT_SECRET} --id=${AMO_APP_ID} --source-dir=${PROJECT_DIR}/dist/web/ext --artifacts-dir=${PROJECT_DIR}/dist/web/build
if [[ $? -ne 0 ]]; then
exit 1
fi
fi
exit 1
echo "**********************************"
echo "* Uploading artifacts to Github..."
echo "**********************************"
......@@ -168,6 +193,7 @@ if [[ $? -ne 0 ]]; then
exit 1
fi
echo "----------------------------------"
echo "- Building desktop artifacts..."
echo "----------------------------------"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment