Skip to content

Commit

Permalink
extension: add option to publish to unlisted in build script
Browse files Browse the repository at this point in the history
  • Loading branch information
karlicoss committed Jan 30, 2023
1 parent 15201d5 commit f663035
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 10 deletions.
2 changes: 1 addition & 1 deletion doc/DEVELOPMENT.org
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ I'm not against it, but with limited time resources full-scale tests give better
: ./build --firefox # you can also use --chrome
: --lint # [optional], run webext linter
: --release # [optional], build in the release mode (with optimizations)
: --publish # [optional], release to the Chrome Web Store/Mozilla addons
: --publish listed # [optional], release to the Chrome Web Store/Mozilla addons

You'll find the result in =dist/=. After that, you can load it in your browser and develop.

Expand Down
6 changes: 3 additions & 3 deletions doc/addons-mozilla-org.org
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
To build the addon (expects Ubuntu 18.04/bionic at the moment):
To build the addon (expects Ubuntu 20.04/jammy at the moment):

#+begin_src
$ sudo apt update && sudo apt install -y git curl
$ curl -fsSL https://deb.nodesource.com/setup_16.x | sudo -E bash -
$ curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash -
$ sudo apt install -y nodejs
$ git clone https://github.com/karlicoss/promnesia.git
$ cd promnesia/extension/
Expand All @@ -18,7 +18,7 @@ NOTE: the easiest ways to test the above instructions in Docker would be

#+begin_src
# run the container
docker run -it ubuntu:bionic /bin/bash
docker run -it ubuntu:jammy /bin/bash

# inside the container
$ sudo apt update && sudo apt install -y sudo
Expand Down
14 changes: 8 additions & 6 deletions extension/build
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ TARGETS = [
'firefox',
]

def main():
def main() -> None:
p = argparse.ArgumentParser()
p.add_argument('--release', action='store_true', help="Use release flavor of build")
p.add_argument('--watch' , action='store_true')
p.add_argument('--lint' , action='store_true')
p.add_argument('--publish', action='store_true', help="Publish on chrome web store/addons.mozilla.org")
p.add_argument('--publish', choices=['listed', 'unlisted'], help="Publish on chrome web store/addons.mozilla.org")

tg = p.add_mutually_exclusive_group(required=True)
tg.add_argument('--target', type=str, choices=TARGETS)
Expand All @@ -37,7 +37,7 @@ def main():
ext_dir = (base_ext_dir / target).resolve() # webext can't into symlinks
# sadly no way to specify zip name in the regex..
artifacts_dir = (base_ext_dir / 'artifacts' / target).resolve()
def webext(*args, **kwargs):
def webext(*args, **kwargs) -> None:
check_call([
'npm', 'run', 'web-ext',
'--',
Expand All @@ -49,7 +49,7 @@ def main():
env = {
'TARGET' : target,
'RELEASE': 'YES' if args.release else 'NO',
'PUBLISH': 'YES' if args.publish else 'NO',
'PUBLISH': 'YES' if args.publish is not None else 'NO',
'EXT_ID' : IDS[target],
**os.environ,
}
Expand Down Expand Up @@ -86,17 +86,19 @@ def main():
'--id' , IDS[target],
]

if args.publish:
if args.publish is not None:
assert args.lint
assert args.release
if 'firefox' in target:
check_call([
'npm', 'run', 'release:amo',
'--',
'--channel', 'listed',
'--channel', args.publish,
'--source-dir', str(ext_dir),
*firefox_release_args(),
])
elif target == 'chrome':
assert args.publish == 'listed' # no notion of unlisted on chrome store?
from chrome_dev_secrets import CLIENT_ID, CLIENT_SECRET, REFRESH_TOKEN
check_call([
'npm', 'run', 'release:cws',
Expand Down

0 comments on commit f663035

Please sign in to comment.