ci: publish separate extension archives
Testing / remote-protocol-compat (0.9.3) (push) Successful in 49s
Testing / remote-protocol-compat (0.9.5) (push) Successful in 53s
Testing / test (push) Successful in 36s
Package Extension / package-extension (push) Successful in 31s
Build & Publish Package / publish (push) Successful in 37s

- Rename the keyed extension package to a testing archive to make its purpose explicit.
- Keep the webstore archive as a separate keyless package for Chrome Web Store upload.
- Upload both extension archives to tagged releases instead of only publishing one ambiguous asset.
- Update the package helper's default suffix and documentation to match the release asset names.
This commit is contained in:
2026-06-14 15:20:48 +02:00
parent 809c73c3a3
commit 65a032f961
2 changed files with 37 additions and 24 deletions
+35 -22
View File
@@ -41,13 +41,15 @@ jobs:
- name: Build extension archives
run: |
python scripts/package_extension.py --out "dist/browser-cli-extension-v${{ steps.version.outputs.version }}.zip"
python scripts/package_extension.py --out "dist/browser-cli-extension-testing-v${{ steps.version.outputs.version }}.zip"
python scripts/package_extension.py --webstore --out "dist/browser-cli-extension-webstore-v${{ steps.version.outputs.version }}.zip"
- name: Publish extension release asset
- name: Publish extension release assets
env:
ACTION_ACCESS_TOKEN: ${{ secrets.ACTION_ACCESS_TOKEN }}
ASSET_NAME: browser-cli-extension-v${{ steps.version.outputs.version }}.zip
ASSET_NAMES: |
browser-cli-extension-testing-v${{ steps.version.outputs.version }}.zip
browser-cli-extension-webstore-v${{ steps.version.outputs.version }}.zip
EXTENSION_VERSION: ${{ steps.version.outputs.version }}
GITHUB_REPOSITORY: ${{ github.repository }}
GITHUB_SERVER_URL: ${{ github.server_url }}
@@ -55,15 +57,19 @@ jobs:
run: |
set -euo pipefail
asset_path="dist/browser-cli-extension-v${EXTENSION_VERSION}.zip"
asset_name="$(basename "$asset_path")"
tag_name="v${EXTENSION_VERSION}"
api_base="${GITHUB_SERVER_URL}/api/v1/repos/${GITHUB_REPOSITORY}"
if [ ! -f "$asset_path" ]; then
echo "Missing asset: $asset_path" >&2
exit 1
fi
while IFS= read -r asset_name; do
[ -n "$asset_name" ] || continue
asset_path="dist/${asset_name}"
if [ ! -f "$asset_path" ]; then
echo "Missing asset: $asset_path" >&2
exit 1
fi
done <<EOF
${ASSET_NAMES}
EOF
release_body="$(mktemp)"
create_body="$(mktemp)"
@@ -142,7 +148,11 @@ jobs:
exit 1
fi
existing_asset_id="$(python - "$release_body" <<'PY'
while IFS= read -r asset_name; do
[ -n "$asset_name" ] || continue
asset_path="dist/${asset_name}"
existing_asset_id="$(ASSET_NAME="$asset_name" python - "$release_body" <<'PY'
import json
import os
import sys
@@ -158,19 +168,22 @@ jobs:
else:
print("")
PY
)"
)"
if [ -n "$existing_asset_id" ]; then
curl --silent --show-error \
--request DELETE \
--header "Authorization: token ${ACTION_ACCESS_TOKEN}" \
--header "Accept: application/json" \
"${api_base}/releases/${release_id}/assets/${existing_asset_id}"
fi
if [ -n "$existing_asset_id" ]; then
curl --silent --show-error \
--request DELETE \
--request POST \
--header "Authorization: token ${ACTION_ACCESS_TOKEN}" \
--header "Accept: application/json" \
"${api_base}/releases/${release_id}/assets/${existing_asset_id}"
fi
curl --silent --show-error \
--request POST \
--header "Authorization: token ${ACTION_ACCESS_TOKEN}" \
--header "Accept: application/json" \
--form "attachment=@${asset_path}" \
"${api_base}/releases/${release_id}/assets?name=${asset_name}"
--form "attachment=@${asset_path}" \
"${api_base}/releases/${release_id}/assets?name=${asset_name}"
done <<EOF
${ASSET_NAMES}
EOF
+2 -2
View File
@@ -1,7 +1,7 @@
#!/usr/bin/env python3
"""Package the Chrome extension.
Default builds a local/unpacked-style archive that keeps manifest.key so the
Default builds a testing/unpacked-style archive that keeps manifest.key so the
extension ID stays stable for native messaging. ``--webstore`` writes the same
runtime files but strips ``key`` from manifest.json because the Chrome Web Store
rejects that field.
@@ -40,7 +40,7 @@ def _copy_tree(src: Path, dst: Path) -> None:
def package_extension(*, webstore: bool = False, out: Path | None = None) -> Path:
manifest = _read_manifest(webstore)
version = manifest["version"]
suffix = "webstore" if webstore else "local"
suffix = "webstore" if webstore else "testing"
out = out or DIST_DIR / f"browser-cli-extension-{suffix}-v{version}.zip"
staging = DIST_DIR / f"extension-package-{suffix}"