add edge addon publish scripts
This commit is contained in:
1 parent
5c3f15c70e
commit
5dba81e4a4
5 files changed
+98
-1
No files matched your search
@@ -0,0 +1,6 @@
|
|||||||
|
HTTP/1.1 411 Length Required
|
||||||
|
Content-Type: text/html; charset=us-ascii
|
||||||
|
Date: Fri, 03 Nov 2023 16:19:55 GMT
|
||||||
|
Connection: close
|
||||||
|
Content-Length: 344
|
||||||
|
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
HTTP/1.1 100 Continue
|
||||||
|
|
||||||
|
HTTP/1.1 202 Accepted
|
||||||
|
Content-Length: 0
|
||||||
|
Location: 9a95fdfe-adfe-4e98-be34-70d029205fea
|
||||||
|
Strict-Transport-Security: max-age=31536000; includeSubDomains
|
||||||
|
Request-Context: appId=cid-v1:23f44029-850d-47f4-8c9f-200d01ff4866
|
||||||
|
Date: Fri, 03 Nov 2023 16:20:15 GMT
|
||||||
|
|
||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "BotExt",
|
"name": "BotExt",
|
||||||
"version": "0.1.0",
|
"version": "0.1.9",
|
||||||
"manifest_version": 3,
|
"manifest_version": 3,
|
||||||
"background": {
|
"background": {
|
||||||
"service_worker": "sw.js"
|
"service_worker": "sw.js"
|
||||||
|
|||||||
@@ -0,0 +1,82 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
client_id="ff7d5a3b-a020-46f5-8d97-b996c3c64f0e"
|
||||||
|
client_secret="5B~8Q~xrpV1-eBkZIPaNL0r6apMbWaFMtAoaSdz6"
|
||||||
|
product_id="f65aed0e-55f6-4b68-9c1b-60bb7000e1e4"
|
||||||
|
file_name="crx.zip"
|
||||||
|
|
||||||
|
zip $file_name crx/*
|
||||||
|
echo "Zip file created."
|
||||||
|
|
||||||
|
# get token
|
||||||
|
token_response=$(curl -s -X POST \
|
||||||
|
-H "Content-Type: application/x-www-form-urlencoded" \
|
||||||
|
-d "client_id=${client_id}" \
|
||||||
|
-d "scope=https://api.addons.microsoftedge.microsoft.com/.default" \
|
||||||
|
-d "client_secret=${client_secret}" \
|
||||||
|
-d "grant_type=client_credentials" \
|
||||||
|
https://login.microsoftonline.com/5c9eedce-81bc-42f3-8823-48ba6258b391/oauth2/v2.0/token)
|
||||||
|
|
||||||
|
token=$(echo $token_response | jq -r '.access_token')
|
||||||
|
|
||||||
|
echo "get token success"
|
||||||
|
# echo token
|
||||||
|
|
||||||
|
# Upload zip file
|
||||||
|
upload_response=$(curl -s -D - \
|
||||||
|
-H "Authorization: Bearer $token" \
|
||||||
|
-H "Content-Type: application/zip" \
|
||||||
|
-X POST \
|
||||||
|
-T $file_name \
|
||||||
|
https://api.addons.microsoftedge.microsoft.com/v1/products/$product_id/submissions/draft/package)
|
||||||
|
|
||||||
|
# Get Location
|
||||||
|
operation_id=$(echo "$upload_response" | grep -Fi Location | awk '{print $2}' | tr -d '\r')
|
||||||
|
# echo $operation_id
|
||||||
|
|
||||||
|
check_response=$(curl -s \
|
||||||
|
-H "Authorization: Bearer $token" \
|
||||||
|
-X GET \
|
||||||
|
https://api.addons.microsoftedge.microsoft.com/v1/products/$product_id/submissions/draft/package/operations/$operation_id)
|
||||||
|
|
||||||
|
# echo $check_response
|
||||||
|
|
||||||
|
errorCode=$(echo $check_response | jq -r '.errorCode')
|
||||||
|
|
||||||
|
if [ "$errorCode" = "null" ]; then
|
||||||
|
echo "Upload successful."
|
||||||
|
else
|
||||||
|
echo "Upload failed. Error code: $errorCode"
|
||||||
|
errors=$(echo $check_response | jq -r '.errors')
|
||||||
|
echo "Error details: $errors"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
publish_response=$(curl -s -D - \
|
||||||
|
-H "Authorization: Bearer $token" \
|
||||||
|
-X POST \
|
||||||
|
-d '{ "notes"="Add some features" }' \
|
||||||
|
https://api.addons.microsoftedge.microsoft.com/v1/products/$product_id/submissions)
|
||||||
|
|
||||||
|
# echo $publish_response
|
||||||
|
|
||||||
|
operation_id=$(echo "$publish_response" | grep -Fi Location | awk '{print $2}' | tr -d '\r')
|
||||||
|
# echo $operation_id
|
||||||
|
|
||||||
|
check_publish_response=$(curl -s \
|
||||||
|
-H "Authorization: Bearer $token" \
|
||||||
|
https://api.addons.microsoftedge.microsoft.com/v1/products/$product_id/submissions/operations/{$operation_id})
|
||||||
|
|
||||||
|
# echo $check_publish_response
|
||||||
|
|
||||||
|
# 使用 jq 提取 errorCode
|
||||||
|
errorCode=$(echo $check_publish_response | jq -r '.errorCode')
|
||||||
|
|
||||||
|
# 检查 errorCode 是否为 null
|
||||||
|
if [ "$errorCode" = "null" ]; then
|
||||||
|
echo "Submit successful."
|
||||||
|
else
|
||||||
|
echo "Operation failed. Error code: $errorCode"
|
||||||
|
errors=$(echo $check_publish_response | jq -r '.message')
|
||||||
|
echo "Error details: $errors"
|
||||||
|
fi
|
||||||
Reference in new issue
Block a user