From e4c91f4f807d65be26f5f2ec8f4ff5ff14273933 Mon Sep 17 00:00:00 2001 From: Dima Gerasimov Date: Sat, 3 Jan 2026 16:38:37 +0000 Subject: [PATCH 1/2] extension: bump version for unlisted AMO --- extension/package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/extension/package.json b/extension/package.json index fbed393..285d1d4 100644 --- a/extension/package.json +++ b/extension/package.json @@ -1,7 +1,7 @@ { "name": "grasp", - "version": "1.0.0", - "version_name": "released on 2024.04.24", + "version": "1.0.2.0", + "version_name": "released on 2026.01.03", "description": "Reliably capture links and webpage content in a plaintext file (org-mode/markdown)", "main": "dist/background.js", "scripts": { From 83630186e8f571cb0a2ca8c631e46ae88cbd1be0 Mon Sep 17 00:00:00 2001 From: Dima Gerasimov Date: Sat, 3 Jan 2026 17:11:34 +0000 Subject: [PATCH 2/2] extension: add AMO metadata to build script --- doc/DEVELOPMENT.org | 8 ++++- extension/build | 87 ++++++++++++++++++++++++++++++++++++++++++--- 2 files changed, 90 insertions(+), 5 deletions(-) diff --git a/doc/DEVELOPMENT.org b/doc/DEVELOPMENT.org index 2b8c03c..59fb178 100644 --- a/doc/DEVELOPMENT.org +++ b/doc/DEVELOPMENT.org @@ -27,10 +27,16 @@ Some tips: - To debug flaky tests, it's useful to use =--count=N= flag (via =pytest-repeat=). * Releasing extension + +- bump extension =version= and =version_name= in =extension/package.json= +- commit your changes (the build script expects a clean git state) + ** AMO (addons.mozilla.org) + : cd extension : npm install # (if necessary) -: ./build --firefox --v2 --lint --release --publish +: source ./webext_secrets.sh # puts api key/secret in the environment +: ./build --firefox --lint --release --publish listed Note that this command will go in a busy loop waiting for the extension to be approved on AMO. (you will see it on https://addons.mozilla.org/en-US/developers/addon/grasp/versions) diff --git a/extension/build b/extension/build index 745bba8..32103e4 100755 --- a/extension/build +++ b/extension/build @@ -24,6 +24,80 @@ TARGETS = [ THISDIR = Path(__file__).absolute().parent +# FFS json doesn't allow newlines, need to put \n, which makes everything unreadable +AMO_METADATA = { + "summary": { + "en-US": "A reliable way of capturing and tagging web pages and content" + }, + "description": { + "en-US": """ +Grasp implements org-capture for Chrome. It adds button and keybindings to capture current page title and url, possibly selected text, additional comments or tags and sends it into your Org Mode file. + +To use it: +- Install the extension from and setup hotkeys if necessary +- You'll also need a running 'backend' to communicate with extension, see instructions [here](https://github.com/karlicoss/grasp#setup) +""" + }, + "requires_payment": False, + "categories": { + "firefox": ["bookmarks"] + }, + "support_email": { + "en-US": "karlicoss.dev@gmail.com" + }, + "homepage": { + "en-US": "https://github.com/karlicoss/grasp" + }, + "version": { + "license": "MIT", + "approval_notes": """ +You can find up-to-date extension code here https://github.com/karlicoss/grasp/tree/master/extension + +The build instructions assume that the zip file with source code is in =/path/to/extension-source-firefox.zip= (on the HOST system). +*Make sure to replace it with the actual path to the source code zip file.* + +To build you need *Ubuntu 24.04/Noble* and *Node 24*. The easiest way to build cleanly would be a Docker container: + +``` +# on the HOST system: cleanup previous container -- if it didn't exist in the first place, it will show an error, ignore it +docker rm -f extension_build + +# on the HOST system: create the container +docker create --name extension_build -it ubuntu:noble /bin/bash + +# on the HOST system: put the sources into the container +docker cp /path/to/extension-source-firefox.zip extension_build:/extension-source-firefox.zip + +# on the HOST system: start the container +docker start -i extension_build +``` + +After that build the addon (run these commands INSIDE the container if you choose to do it with Docker): + +``` +$ apt update && apt install -y git curl unzip +$ curl -fsSL https://deb.nodesource.com/setup_24.x | bash - +$ DEBIAN_FRONTEND=noninteractive apt install -y nodejs +$ unzip extension-source-firefox.zip -d extension +$ cd extension +$ npm install +$ ./build --firefox --release --lint --publish=skip +``` + + +The final artifact will be in =/extension/dist/artifacts/firefox/grasp-.zip= (INSIDE the container). + +If you need to get it back onto the HOST system (e.g. to test in the browser), run on the HOST system (e.g. in a separate terminal): + +docker cp extension_build:/extension/dist/artifacts/firefox/grasp-.zip + +This will copy it into the current directory on the HOST system. +""" + } +} + + + npm = "npm.cmd" if sys.platform == "win32" else "npm" @@ -123,7 +197,11 @@ def main() -> None: check_call(['git', 'archive', 'HEAD', '--output', source_zip], cwd=THISDIR) # cwd so we only package the extension if 'firefox' in target: - from firefox_dev_secrets import API_KEY, API_SECRET + amo_metadata = THISDIR / 'amo-metadata.json' + amo_metadata.write_text(json.dumps(AMO_METADATA, indent=2)) + + # see https://extensionworkshop.com/documentation/develop/web-ext-command-reference/#web-ext-sign + assert ('WEB_EXT_API_KEY' in os.environ) and ('WEB_EXT_API_SECRET' in os.environ), "WEB_EXT_API_KEY and WEB_EXT_API_SECRET environment variables must be set for publishing to AMO" check_call([ npm, 'run', 'web-ext', '--', @@ -131,10 +209,11 @@ def main() -> None: '--channel', args.publish, '--source-dir', str(ext_dir), '--artifacts-dir', str(artifacts_dir), - '--api-key' , API_KEY, - '--api-secret' , API_SECRET, + # this will be passed automatically from env + # '--api-key' , ..., + # '--api-secret' , ..., # seems like webext sign requires addon id to be in manifest now - '--amo-metadata' , THISDIR / 'amo-metadata.json', + '--amo-metadata' , amo_metadata, '--upload-source-code', source_zip, ]) elif target == 'chrome':