-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcws-submit.sh
More file actions
executable file
·30 lines (24 loc) · 1012 Bytes
/
cws-submit.sh
File metadata and controls
executable file
·30 lines (24 loc) · 1012 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/usr/bin/env bash
# Submit the current Chrome Web Store draft for review.
#
# Run after cws-upload.sh, or after verifying the draft in the Dashboard.
#
# Requires .env.submit with CHROME_CLIENT_ID, CHROME_CLIENT_SECRET,
# CHROME_REFRESH_TOKEN, and CHROME_EXTENSION_ID.
#
# Usage: scripts/cws-submit.sh
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
PROJECT_DIR="$(dirname "$SCRIPT_DIR")"
# shellcheck source=/dev/null
source "$PROJECT_DIR/.env.submit"
TOKEN=$(curl -s -X POST "https://oauth2.googleapis.com/token" \
-d "client_id=$CHROME_CLIENT_ID&client_secret=$CHROME_CLIENT_SECRET&refresh_token=$CHROME_REFRESH_TOKEN&grant_type=refresh_token" \
| python3 -c "import sys,json; print(json.load(sys.stdin)['access_token'])")
echo "Submitting for review ..."
curl -s -X POST \
-H "Authorization: Bearer $TOKEN" \
-H "x-goog-api-version: 2" \
-H "Content-Length: 0" \
"https://www.googleapis.com/chromewebstore/v1.1/items/$CHROME_EXTENSION_ID/publish" \
| python3 -m json.tool