From d7e594474828872e241f0a86e5bc39e645b66340 Mon Sep 17 00:00:00 2001 From: Jonatan Date: Sun, 31 Mar 2019 14:57:07 -0400 Subject: [PATCH] publish in ci --- .circleci/config.yml | 35 ++++++++++++++++++++++++++++++++--- README.md | 2 +- package.json | 2 +- src/manifest.json | 2 +- utils/package.sh | 5 +++++ utils/publish.sh | 8 ++++++++ 6 files changed, 48 insertions(+), 6 deletions(-) create mode 100755 utils/package.sh create mode 100755 utils/publish.sh diff --git a/.circleci/config.yml b/.circleci/config.yml index 32066eb..24a427c 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -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' @@ -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 diff --git a/README.md b/README.md index 5283555..fa4a3cc 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/package.json b/package.json index 699f92b..bd67b7f 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/src/manifest.json b/src/manifest.json index 908eb3e..d51560d 100644 --- a/src/manifest.json +++ b/src/manifest.json @@ -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": { diff --git a/utils/package.sh b/utils/package.sh new file mode 100755 index 0000000..4692ea0 --- /dev/null +++ b/utils/package.sh @@ -0,0 +1,5 @@ +#!/usr/bin/env bash + +package_name="${PACKAGE_NAME:-dyslexia-friendly.zip}" +cd build +zip -r ../"${package_name}" * diff --git a/utils/publish.sh b/utils/publish.sh new file mode 100755 index 0000000..8357b40 --- /dev/null +++ b/utils/publish.sh @@ -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" +