This repository has been archived by the owner on Jan 23, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 18
/
release.sh
executable file
·63 lines (53 loc) · 1.9 KB
/
release.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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#!/usr/bin/env bash
sentry_api_key="$(cat sentry_api.key)"
version="$(cat src/manifest.json | jq --raw-output .version)"
app_id='blbompphddfibggfmmfcgjjoadebinem'
g_client_id="$(cat webstore_client.id)"
g_client_secret="$(cat webstore_client.secret)"
g_refresh_token="$(cat webstore_client.refresh_token)"
./package.sh --just-zip
# Get a Google access token.
echo 'getting access token...'
g_access_token="$(curl https://www.googleapis.com/oauth2/v4/token \
-d "client_id=${g_client_id}&client_secret=${g_client_secret}&refresh_token=${g_refresh_token}&grant_type=refresh_token&redirect_uri=urn:ietf:wg:oauth:2.0:oob" \
-q \
| jq --raw-output .access_token)"
echo
# Upload to Google.
echo 'uploading...'
curl "https://www.googleapis.com/upload/chromewebstore/v1.1/items/${app_id}" \
-H "Authorization: Bearer ${g_access_token}" \
-H "x-goog-api-version: 2" \
-X PUT \
-T Autoplaylists-for-Google-Music.zip \
--progress-bar
echo
# Publish to everyone.
echo 'publishing...'
curl "https://www.googleapis.com/chromewebstore/v1.1/items/${app_id}/publish" \
-H "Authorization: Bearer ${g_access_token}" \
-X POST \
-d ""
echo
# Create a new release.
echo 'pushing to sentry...'
curl https://app.getsentry.com/api/0/projects/simon-weber/autoplaylists-extension/releases/ \
-u "${sentry_api_key}": \
-X POST \
-d '{"version": "'"${version}"'"}' \
-H 'Content-Type: application/json'
echo
for file in src/js-built/*.js*; do
echo "${file}"
name="chrome-extension://blbompphddfibggfmmfcgjjoadebinem/js-built/$(basename ${file})"
# Upload a file for the given release.
curl "https://app.getsentry.com/api/0/projects/simon-weber/autoplaylists-extension/releases/${version}/files/" \
-u "${sentry_api_key}": \
-X POST \
-F file=@"${file}" \
-F name="${name}"
echo
done
git tag -a "${version}" -m 'see changelog'
git push origin "${version}"
git push