-
Notifications
You must be signed in to change notification settings - Fork 0
/
deploy.sh
executable file
·41 lines (33 loc) · 1.5 KB
/
deploy.sh
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
31
32
33
34
35
36
37
38
39
40
41
echo ""
echo "Auth: getting access token from Chrome Web Store API ..."
open "https://accounts.google.com/o/oauth2/auth?response_type=code&scope=https://www.googleapis.com/auth/chromewebstore&client_id=$CLIENT_ID&redirect_uri=urn:ietf:wg:oauth:2.0:oob"
echo "Enter the auth code provided by Google:"
read CODE
RESPONSE=$(curl --silent "https://accounts.google.com/o/oauth2/token" -d "client_id=$CLIENT_ID&client_secret=$CLIENT_SECRET&code=$CODE&grant_type=authorization_code&redirect_uri=urn:ietf:wg:oauth:2.0:oob")
ACCESS_TOKEN=$(echo $RESPONSE | jq --raw-output .access_token)
echo "=> access token: $ACCESS_TOKEN"
echo ""
echo "Uploading archive to Chrome Web Store ..."
curl \
-H "Authorization: Bearer $ACCESS_TOKEN" \
-H "x-goog-api-version: 2" \
-X PUT \
-T marlowe.zip \
--silent \
https://www.googleapis.com/upload/chromewebstore/v1.1/items/$APP_ID
echo ""
echo "=> done. :-)"
echo ""
echo "Now, update the description field (e.g. changelog), then publish changes on:"
echo " https://chrome.google.com/webstore/developer/edit/$APP_ID"
open https://chrome.google.com/webstore/developer/edit/$APP_ID
# TODO: find a way to automatically update changelog in extension's description field,
# (https://developer.chrome.com/webstore/api_index) then publish with this:
# echo "Publishing update ..."
# curl \
# -H "Authorization: Bearer $ACCESS_TOKEN" \
# -H "x-goog-api-version: 2" \
# -H "Content-Length: 0" \
# -X POST \
# -v \
# https://www.googleapis.com/chromewebstore/v1.1/items/$APP_ID/publish