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
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:
@@ -41,13 +41,15 @@ jobs:
|
|||||||
|
|
||||||
- name: Build extension archives
|
- name: Build extension archives
|
||||||
run: |
|
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"
|
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:
|
env:
|
||||||
ACTION_ACCESS_TOKEN: ${{ secrets.ACTION_ACCESS_TOKEN }}
|
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 }}
|
EXTENSION_VERSION: ${{ steps.version.outputs.version }}
|
||||||
GITHUB_REPOSITORY: ${{ github.repository }}
|
GITHUB_REPOSITORY: ${{ github.repository }}
|
||||||
GITHUB_SERVER_URL: ${{ github.server_url }}
|
GITHUB_SERVER_URL: ${{ github.server_url }}
|
||||||
@@ -55,15 +57,19 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
asset_path="dist/browser-cli-extension-v${EXTENSION_VERSION}.zip"
|
|
||||||
asset_name="$(basename "$asset_path")"
|
|
||||||
tag_name="v${EXTENSION_VERSION}"
|
tag_name="v${EXTENSION_VERSION}"
|
||||||
api_base="${GITHUB_SERVER_URL}/api/v1/repos/${GITHUB_REPOSITORY}"
|
api_base="${GITHUB_SERVER_URL}/api/v1/repos/${GITHUB_REPOSITORY}"
|
||||||
|
|
||||||
|
while IFS= read -r asset_name; do
|
||||||
|
[ -n "$asset_name" ] || continue
|
||||||
|
asset_path="dist/${asset_name}"
|
||||||
if [ ! -f "$asset_path" ]; then
|
if [ ! -f "$asset_path" ]; then
|
||||||
echo "Missing asset: $asset_path" >&2
|
echo "Missing asset: $asset_path" >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
done <<EOF
|
||||||
|
${ASSET_NAMES}
|
||||||
|
EOF
|
||||||
|
|
||||||
release_body="$(mktemp)"
|
release_body="$(mktemp)"
|
||||||
create_body="$(mktemp)"
|
create_body="$(mktemp)"
|
||||||
@@ -142,7 +148,11 @@ jobs:
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
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 json
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
@@ -174,3 +184,6 @@ jobs:
|
|||||||
--header "Accept: application/json" \
|
--header "Accept: application/json" \
|
||||||
--form "attachment=@${asset_path}" \
|
--form "attachment=@${asset_path}" \
|
||||||
"${api_base}/releases/${release_id}/assets?name=${asset_name}"
|
"${api_base}/releases/${release_id}/assets?name=${asset_name}"
|
||||||
|
done <<EOF
|
||||||
|
${ASSET_NAMES}
|
||||||
|
EOF
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
"""Package the Chrome extension.
|
"""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
|
extension ID stays stable for native messaging. ``--webstore`` writes the same
|
||||||
runtime files but strips ``key`` from manifest.json because the Chrome Web Store
|
runtime files but strips ``key`` from manifest.json because the Chrome Web Store
|
||||||
rejects that field.
|
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:
|
def package_extension(*, webstore: bool = False, out: Path | None = None) -> Path:
|
||||||
manifest = _read_manifest(webstore)
|
manifest = _read_manifest(webstore)
|
||||||
version = manifest["version"]
|
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"
|
out = out or DIST_DIR / f"browser-cli-extension-{suffix}-v{version}.zip"
|
||||||
staging = DIST_DIR / f"extension-package-{suffix}"
|
staging = DIST_DIR / f"extension-package-{suffix}"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user