-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.travis.yml
44 lines (32 loc) · 1.42 KB
/
.travis.yml
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
install:
- sudo apt-get -y update
- sudo apt-get -y install curl jq
script:
- echo $TRAVIS_BRANCH
- LAST_VERSION=$(git describe --tags --abbrev=0)
- echo $LAST_VERSION
- CURRENT_VERSION=$(jq -r .version ./manifest.json)
- echo $CURRENT_VERSION
- git archive -o HelloElectsys-$CURRENT_VERSION.zip HEAD
- git add .
- git commit -m "Add archive zip"
- ls
- ACCESS_TOKEN=$(curl -s "https://accounts.google.com/o/oauth2/token" -d "client_id=${CLIENT_ID}&client_secret=${CLIENT_SECRET}&refresh_token=${REFRESH_TOKEN}&grant_type=refresh_token&redirect_uri=urn:ietf:wg:oauth:2.0:oob" | jq -r .access_token)
- UPLOAD_RESPONSE=$(curl -s -H "Authorization:Bearer ${ACCESS_TOKEN}" -H "x-goog-api-version:2" -X PUT -T HelloElectsys-$CURRENT_VERSION.zip "https://www.googleapis.com/upload/chromewebstore/v1.1/items/${APP_ID}")
- echo $UPLOAD_RESPONSE
- PUBLISH_RESPONSE=$(curl -s -H "Authorization:Bearer ${ACCESS_TOKEN}" -H "x-goog-api-version:2" -H "Content-Length:0" -X POST "https://www.googleapis.com/chromewebstore/v1.1/items/${APP_ID}/publish")
- echo $PUBLISH_RESPONSE
before_deploy:
- git config --local user.name "clouduan-by-travis"
- git config --local user.email "[email protected]"
- git tag $CURRENT_VERSION
- ls
deploy:
provider: releases
api_key:
secure: $GITHUB_API_TOKEN
file: ./HelloElectsys-$CURRENT_VERSION.zip
on:
# repo: clouduan/HelloElectsys
branch: master
condition: $CURRENT_VERSION > $LAST_VERSION