BTHLABS-66: Prepping for public release: Take two

This commit is contained in:
2025-11-19 20:28:31 +01:00
parent 38785ccf92
commit 22061486a8
6 changed files with 96 additions and 24 deletions

View File

@@ -14,7 +14,7 @@ import werkzeug
import werkzeug.routing
from hotpocket_workspace_tools import get_workspace_mode
from hotpocket_workspace_tools.tasks import * # noqa: F401,F403
from hotpocket_workspace_tools.tasks import bump_version, get_version # noqa: F401
WORKSPACE_MODE = get_workspace_mode()
@@ -198,26 +198,54 @@ def build_safari(ctx: Context):
@task(pre=[clean])
def build_chrome(ctx: Context):
ctx.run('yarn build:chrome')
ctx.run(' '.join([
r'/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome',
'--pack-extension=dist/chrome-production/',
'--pack-extension-key=secrets/chrome.pem',
]))
with ctx.cd('dist/chrome-production'):
current_version = get_version(ctx)
ctx.run(' '.join([
'zip',
'-r',
f'../chrome-production-{current_version}.zip',
'.',
]))
@task(pre=[clean])
def build_firefox(ctx: Context):
ctx.run('yarn build:firefox')
firefox_secrets = None
with open('secrets/firefox.json', 'r', encoding='utf-8') as firefox_secrets_f:
firefox_secrets = json.load(firefox_secrets_f)
with ctx.cd('dist/firefox-production'):
ctx.run(' '.join([
'web-ext',
'sign',
'--channel=unlisted',
f'--api-key={firefox_secrets["api_key"]}',
f'--api-secret={firefox_secrets["api_secret"]}',
'lint',
]))
current_version = get_version(ctx)
ctx.run(' '.join([
'zip',
'-r',
f'../firefox-production-{current_version}.zip',
'.',
]))
@task
def build_firefox_source(ctx: Context):
# AMO requires source bundle to be uploaded alongside the built version.
ctx.run('rm -rf dist/firefox-source')
ctx.run('mkdir -p dist/firefox-source dist/firefox-source/assets dist/firefox-source/src')
ctx.run('rsync -arv assets/ dist/firefox-source/assets/')
ctx.run('rsync -arv src/ dist/firefox-source/src/')
ctx.run('rsync -arv eslint.config.js package.json README.md rollup.config.js yarn.lock dist/firefox-source/')
with ctx.cd('dist/firefox-source'):
current_version = get_version(ctx)
ctx.run(' '.join([
'zip',
'-r',
f'../firefox-source-{current_version}.zip',
'.',
]))