Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update extension dependencies and web-ext #449

Merged
merged 3 commits into from
Jun 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions extension/amo-metadata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"version": {
"approval_notes": "just testing approval notes via API"
}
}
41 changes: 21 additions & 20 deletions extension/build
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,13 @@ TARGETS = [
'firefox',
]


THISDIR = Path(__file__).absolute().parent


npm = "npm.cmd" if sys.platform == "win32" else "npm"


def main() -> None:
p = argparse.ArgumentParser()
p.add_argument('--release', action='store_true', help="Use release flavor of build")
Expand All @@ -45,7 +50,7 @@ def main() -> None:
'chrome': '3',
}[target]

base_ext_dir = Path(__file__).absolute().parent / 'dist'
base_ext_dir = THISDIR / 'dist'
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()
Expand Down Expand Up @@ -94,15 +99,10 @@ def main() -> None:
}

if args.watch:
check_call([
npm, 'run', 'watch',
], env=env, cwd=str(Path(__file__).absolute().parent))
# TODO exec instead?
check_call([npm, 'run', 'watch'], env=env, cwd=str(THISDIR)) # TODO exec instead?
return

check_call([
npm, 'run', 'build',
], env=env, cwd=str(Path(__file__).absolute().parent))
check_call([npm, 'run', 'build'], env=env, cwd=str(THISDIR))

if args.lint:
# TODO --self-hosted
Expand All @@ -112,30 +112,31 @@ def main() -> None:
# TODO move somewhere more appropriate..
webext('build', '-o') # -o overwrites existing artifact


if args.release:
assert args.lint # TODO not sure..

def firefox_publish_args():
from firefox_dev_secrets import API_KEY, API_SECRET
return [
'--artifacts-dir', str(artifacts_dir),
'--api-key' , API_KEY,
'--api-secret' , API_SECRET,
# seems like webext sign requires addon id to be in manifest now
]

if args.publish is not None:
assert args.lint
assert args.release

# TODO check repo is clean?? maybe only if listed?
source_zip = base_ext_dir / 'promnesia-source.zip'
check_call(['git', 'archive', 'HEAD', '--output', source_zip], cwd=THISDIR)

if 'firefox' in target:
from firefox_dev_secrets import API_KEY, API_SECRET
check_call([
npm, 'run', 'web-ext',
'--',
'sign', '--use-submission-api',
'sign',
'--channel', args.publish,
'--source-dir', str(ext_dir),
*firefox_publish_args(),
'--artifacts-dir', str(artifacts_dir),
'--api-key' , API_KEY,
'--api-secret' , API_SECRET,
# seems like webext sign requires addon id to be in manifest now
'--amo-metadata' , THISDIR / 'amo-metadata.json',
'--upload-source-code', source_zip,
])
elif target == 'chrome':
assert args.publish == 'listed' # no notion of unlisted on chrome store?
Expand Down
Loading
Loading