Skip to content

Commit

Permalink
Merge pull request #21 from javoire/ci
Browse files Browse the repository at this point in the history
publish in ci
  • Loading branch information
javoire committed Mar 31, 2019
2 parents 9bfdc15 + d7e5944 commit 3087203
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 6 deletions.
35 changes: 32 additions & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,35 @@
workflows:
version: 2
main:
jobs:
- build:
filters:
tags:
only: /.*/
- publish:
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:
name: 'Dependencies'
command: |
apt-get update
apt-get -y install curl jq
apt-get -y install curl jq zip
yarn
- run:
name: 'Build'
Expand All @@ -21,4 +39,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 3087203

Please sign in to comment.