Skip to content

Commit

Permalink
publish in ci
Browse files Browse the repository at this point in the history
  • Loading branch information
javoire committed Mar 31, 2019
1 parent 9bfdc15 commit 38f6252
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 5 deletions.
35 changes: 33 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,30 @@
workflows:
version: 2
main:
jobs:
- build:
context: vars
filters:
tags:
only: /.*/
- publish:
context: vars
requires:
- build
filters:
# ensure publish only runs on pushed tags
branches:
ignore: /.*/
tags:
only: /.*/

version: 2
jobs:
build:
docker:
- image: node:11
environment:
- APP_ID: miepjgfkkommhllbbjaedffcpkncboeo
- PACKAGE_NAME: dyslexia-friendly.zip
steps:
- checkout
- run:
Expand All @@ -21,4 +41,15 @@ jobs:
command: yarn test
- run:
name: 'Package'
command: git archive -o dyslexia-friendly.zip HEAD
command: utils/package.sh
publish:
docker:
- image: node:11
environment:
- APP_ID: miepjgfkkommhllbbjaedffcpkncboeo
# TODO: find a way to not have to specify this twice
- PACKAGE_NAME: dyslexia-friendly.zip
steps:
- run:
name: 'Publish'
command: utils/publish.sh
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ The features listed here are also implemented: http://antijingoist.github.io/web
Develop
-----

To use the extension in developer mode, just navigate to
To use the extension in developer mode, navigate to

> chrome://extensions
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "dyslexia-friendly",
"version": "0.1.1",
"version": "1.0.0",
"description": "Increases readability of web pages by changing fonts, contrast and adding a reading ruler",
"dependencies": {
"jquery": "^3.3.1",
Expand Down
2 changes: 1 addition & 1 deletion src/manifest.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Dyslexia Friendly",
"version": "0.1.1",
"version": "1.0.0",
"manifest_version": 2,
"description": "Increases readability of web pages by changing fonts, contrast and adding a reading ruler",
"icons": {
Expand Down
5 changes: 5 additions & 0 deletions utils/package.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env bash

package_name="${PACKAGE_NAME:-dyslexia-friendly.zip}"
cd build
zip -r ../"${package_name}" *
8 changes: 8 additions & 0 deletions utils/publish.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/usr/bin/env bash

# Upload and publish to Chrome Web Store

ACCESS_TOKEN=$(curl "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)
curl -H "Authorization: Bearer ${ACCESS_TOKEN}" -H "x-goog-api-version: 2" -X PUT -T ${PACKAGE_NAME} -v "https://www.googleapis.com/upload/chromewebstore/v1.1/items/${APP_ID}"
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"

0 comments on commit 38f6252

Please sign in to comment.