From 6952584549d743753e6483d1abb150f58659ad7c Mon Sep 17 00:00:00 2001 From: Fabian Weber Date: Thu, 18 Jul 2019 12:59:54 +0200 Subject: [PATCH 01/18] added publish scripts --- .circleci/config.yml | 15 ++++++++++++- package.json | 4 ++-- scripts/build-zip.js | 50 ++++++++++++++++++++++---------------------- scripts/publish.sh | 4 ++++ 4 files changed, 45 insertions(+), 28 deletions(-) create mode 100644 scripts/publish.sh diff --git a/.circleci/config.yml b/.circleci/config.yml index 73ecc11bf9..d5969e766b 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -29,7 +29,7 @@ jobs: steps: - checkout - run: yarn add simsala - - run: node node_modules/simsala/src/cli.js check + - run: node node_modules/simsala/src/cli.js check lint: docker: @@ -129,6 +129,13 @@ jobs: git pull git merge origin/master git push + publish: + steps: + - run: + command: | + npm run build + npm run build-zip + ./scripts/publish.sh ./dist-zip/lunie-browser-extension.zip workflows: version: 2 @@ -175,3 +182,9 @@ workflows: filters: branches: only: master + publish: + jobs: + - publish: + filters: + branches: + only: master diff --git a/package.json b/package.json index e1874c3dbe..0747266c6c 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { - "name": "lunie-signer-x", + "name": "lunie-browser-extension", "version": "1.0.0", - "description": "A Vue.js web extension", + "description": "A browser extensio to manage keys and sign online", "author": "fabian@lunie.io", "licenses": [ { diff --git a/scripts/build-zip.js b/scripts/build-zip.js index 71605d818f..ad8289ab82 100644 --- a/scripts/build-zip.js +++ b/scripts/build-zip.js @@ -1,53 +1,53 @@ #!/usr/bin/env node -const fs = require('fs'); -const path = require('path'); -const archiver = require('archiver'); +const fs = require('fs') +const path = require('path') +const archiver = require('archiver') -const DEST_DIR = path.join(__dirname, '../dist'); -const DEST_ZIP_DIR = path.join(__dirname, '../dist-zip'); +const DEST_DIR = path.join(__dirname, '../dist') +const DEST_ZIP_DIR = path.join(__dirname, '../dist-zip') const extractExtensionData = () => { - const extPackageJson = require('../package.json'); + const extPackageJson = require('../package.json') return { name: extPackageJson.name, - version: extPackageJson.version, - }; -}; + version: extPackageJson.version + } +} const makeDestZipDirIfNotExists = () => { if (!fs.existsSync(DEST_ZIP_DIR)) { - fs.mkdirSync(DEST_ZIP_DIR); + fs.mkdirSync(DEST_ZIP_DIR) } -}; +} const buildZip = (src, dist, zipFilename) => { - console.info(`Building ${zipFilename}...`); + console.info(`Building ${zipFilename}...`) - const archive = archiver('zip', { zlib: { level: 9 } }); - const stream = fs.createWriteStream(path.join(dist, zipFilename)); + const archive = archiver('zip', { zlib: { level: 9 } }) + const stream = fs.createWriteStream(path.join(dist, zipFilename)) return new Promise((resolve, reject) => { archive .directory(src, false) .on('error', err => reject(err)) - .pipe(stream); + .pipe(stream) - stream.on('close', () => resolve()); - archive.finalize(); - }); -}; + stream.on('close', () => resolve()) + archive.finalize() + }) +} const main = () => { - const { name, version } = extractExtensionData(); - const zipFilename = `${name}-v${version}.zip`; + const { name, version } = extractExtensionData() + const zipFilename = `${name}.zip` - makeDestZipDirIfNotExists(); + makeDestZipDirIfNotExists() buildZip(DEST_DIR, DEST_ZIP_DIR, zipFilename) .then(() => console.info('OK')) - .catch(console.err); -}; + .catch(console.err) +} -main(); +main() diff --git a/scripts/publish.sh b/scripts/publish.sh new file mode 100644 index 0000000000..5b9f3e3c21 --- /dev/null +++ b/scripts/publish.sh @@ -0,0 +1,4 @@ +#!/bin/sh + +ACCESS_TOKEN=$(curl "https://www.googleapis.com/oauth2/v4/token" -d "client_id=${CLIENT_ID}&client_secret=${CLIENT_SECRET}&refresh_token=${REFRESH_TOKEN}&grant_type=refresh_token" | jq -r .access_token) +curl -H "Authorization: Bearer ${ACCESS_TOKEN}" -H "x-goog-api-version: 2" -X PUT -T $1 -v "https://www.googleapis.com/upload/chromewebstore/v1.1/items/${APP_ID}" \ No newline at end of file From 2d0b7836f7db021736ef70be2a46a19b4864c1dd Mon Sep 17 00:00:00 2001 From: Fabian Weber Date: Thu, 18 Jul 2019 13:00:53 +0200 Subject: [PATCH 02/18] changelog --- pending/fabo_publish | 1 + 1 file changed, 1 insertion(+) create mode 100644 pending/fabo_publish diff --git a/pending/fabo_publish b/pending/fabo_publish new file mode 100644 index 0000000000..3928631c2b --- /dev/null +++ b/pending/fabo_publish @@ -0,0 +1 @@ +[Repository] [#63](https://github.com/cosmos/lunie/issues/63) Automatic releases @faboweb \ No newline at end of file From 0cf17aff95154c128bc6b79612f3a36b54f28dc5 Mon Sep 17 00:00:00 2001 From: Fabian Weber Date: Thu, 18 Jul 2019 13:01:23 +0200 Subject: [PATCH 03/18] linted --- scripts/build-zip.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/build-zip.js b/scripts/build-zip.js index ad8289ab82..0f474cca49 100644 --- a/scripts/build-zip.js +++ b/scripts/build-zip.js @@ -40,7 +40,7 @@ const buildZip = (src, dist, zipFilename) => { } const main = () => { - const { name, version } = extractExtensionData() + const { name } = extractExtensionData() const zipFilename = `${name}.zip` makeDestZipDirIfNotExists() From 4fc09039635bd700d71b2203efda2e97c40cf2bb Mon Sep 17 00:00:00 2001 From: Fabian Weber Date: Thu, 18 Jul 2019 13:03:05 +0200 Subject: [PATCH 04/18] added image for publish step --- .circleci/config.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index d5969e766b..13faefa25e 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -129,7 +129,10 @@ jobs: git pull git merge origin/master git push + # publish to the Chrome Web Store publish: + docker: + - image: circleci/node:10.15.3 steps: - run: command: | From 1f405d63e74574ffaa157a0a1e4681fbee1bf295 Mon Sep 17 00:00:00 2001 From: Fabian Weber Date: Thu, 18 Jul 2019 13:04:53 +0200 Subject: [PATCH 05/18] checkout code for publish --- .circleci/config.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index 13faefa25e..54e83a26bb 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -129,11 +129,13 @@ jobs: git pull git merge origin/master git push + # publish to the Chrome Web Store publish: docker: - image: circleci/node:10.15.3 steps: + - checkout - run: command: | npm run build From a0b1d293eea46e0d638bc2e9741dc2022571eb2e Mon Sep 17 00:00:00 2001 From: Fabian Weber Date: Thu, 18 Jul 2019 13:06:05 +0200 Subject: [PATCH 06/18] try fixing ci config --- .circleci/config.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 54e83a26bb..c87b13bb49 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -136,8 +136,7 @@ jobs: - image: circleci/node:10.15.3 steps: - checkout - - run: - command: | + - run: | npm run build npm run build-zip ./scripts/publish.sh ./dist-zip/lunie-browser-extension.zip From 6163c31ab707b17eaf26778ba2afda3212928be4 Mon Sep 17 00:00:00 2001 From: Fabian Weber Date: Thu, 18 Jul 2019 13:17:31 +0200 Subject: [PATCH 07/18] adjust variables in publish script --- scripts/publish.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/publish.sh b/scripts/publish.sh index 5b9f3e3c21..7cae142646 100644 --- a/scripts/publish.sh +++ b/scripts/publish.sh @@ -1,4 +1,4 @@ #!/bin/sh -ACCESS_TOKEN=$(curl "https://www.googleapis.com/oauth2/v4/token" -d "client_id=${CLIENT_ID}&client_secret=${CLIENT_SECRET}&refresh_token=${REFRESH_TOKEN}&grant_type=refresh_token" | jq -r .access_token) +ACCESS_TOKEN=$(curl "https://www.googleapis.com/oauth2/v4/token" -d "client_id=${GAPI_CLIENT_ID}&client_secret=${GAPI_CLIENT_SECRET}&refresh_token=${GAPI_REFRESH_TOKEN}&grant_type=refresh_token" | jq -r .access_token) curl -H "Authorization: Bearer ${ACCESS_TOKEN}" -H "x-goog-api-version: 2" -X PUT -T $1 -v "https://www.googleapis.com/upload/chromewebstore/v1.1/items/${APP_ID}" \ No newline at end of file From 8c4fe1417d55cf2b0dfab5dfda0b318a1a1ac8bb Mon Sep 17 00:00:00 2001 From: Fabian Weber Date: Thu, 18 Jul 2019 13:18:20 +0200 Subject: [PATCH 08/18] test --- .circleci/config.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index c87b13bb49..38b75a1512 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -189,6 +189,3 @@ workflows: publish: jobs: - publish: - filters: - branches: - only: master From 60b2cd275035fc6b7825fff00ebf17d6dde687eb Mon Sep 17 00:00:00 2001 From: Fabian Weber Date: Thu, 18 Jul 2019 13:19:11 +0200 Subject: [PATCH 09/18] typo --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 38b75a1512..6429ae64ac 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -188,4 +188,4 @@ workflows: only: master publish: jobs: - - publish: + - publish From 809a1b433cc24fb8c5ee9f69978da88f68f60794 Mon Sep 17 00:00:00 2001 From: Fabian Weber Date: Thu, 18 Jul 2019 13:26:06 +0200 Subject: [PATCH 10/18] install deps in publish step --- .circleci/config.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index 6429ae64ac..61f6aa1bd2 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -136,6 +136,7 @@ jobs: - image: circleci/node:10.15.3 steps: - checkout + - yarn-install - run: | npm run build npm run build-zip From 5efde377770f93995fbe3ccf593a7fb6661c1951 Mon Sep 17 00:00:00 2001 From: Fabian Weber Date: Thu, 18 Jul 2019 13:26:45 +0200 Subject: [PATCH 11/18] test only publish for now --- .circleci/config.yml | 58 ++++++++++++++++++++++---------------------- 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 61f6aa1bd2..112d3e7bb0 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -144,35 +144,35 @@ jobs: workflows: version: 2 - build-and-deploy: - jobs: - # Static checks before - - pendingUpdated: - filters: - branches: - ignore: - - release - - master - - - security: - filters: - branches: - ignore: release - - - lint: - filters: - branches: - ignore: release - - - testUnit: - filters: - branches: - ignore: release - - - testE2E: - filters: - branches: - ignore: release + # build-and-deploy: + # jobs: + # # Static checks before + # - pendingUpdated: + # filters: + # branches: + # ignore: + # - release + # - master + + # - security: + # filters: + # branches: + # ignore: release + + # - lint: + # filters: + # branches: + # ignore: release + + # - testUnit: + # filters: + # branches: + # ignore: release + + # - testE2E: + # filters: + # branches: + # ignore: release releaseManually: jobs: From 351779b081e1503a4fc87acedc6fedb6a764a48a Mon Sep 17 00:00:00 2001 From: Fabian Weber Date: Thu, 18 Jul 2019 13:28:29 +0200 Subject: [PATCH 12/18] init submodules --- .circleci/config.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index 112d3e7bb0..b687462c72 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -138,6 +138,7 @@ jobs: - checkout - yarn-install - run: | + npm run initiate-submodule npm run build npm run build-zip ./scripts/publish.sh ./dist-zip/lunie-browser-extension.zip From 1d9c9bee56781f2108465913070720883be96d6c Mon Sep 17 00:00:00 2001 From: Fabian Weber Date: Thu, 18 Jul 2019 13:30:56 +0200 Subject: [PATCH 13/18] made script executable --- scripts/publish.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 scripts/publish.sh diff --git a/scripts/publish.sh b/scripts/publish.sh old mode 100644 new mode 100755 From fd6c5928d7c90ea0e3811d0a48b530253ed4f296 Mon Sep 17 00:00:00 2001 From: Fabian Weber Date: Thu, 18 Jul 2019 14:02:59 +0200 Subject: [PATCH 14/18] use simple access token --- scripts/publish.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/scripts/publish.sh b/scripts/publish.sh index 7cae142646..1a522e6062 100755 --- a/scripts/publish.sh +++ b/scripts/publish.sh @@ -1,4 +1,3 @@ #!/bin/sh -ACCESS_TOKEN=$(curl "https://www.googleapis.com/oauth2/v4/token" -d "client_id=${GAPI_CLIENT_ID}&client_secret=${GAPI_CLIENT_SECRET}&refresh_token=${GAPI_REFRESH_TOKEN}&grant_type=refresh_token" | jq -r .access_token) curl -H "Authorization: Bearer ${ACCESS_TOKEN}" -H "x-goog-api-version: 2" -X PUT -T $1 -v "https://www.googleapis.com/upload/chromewebstore/v1.1/items/${APP_ID}" \ No newline at end of file From f8e87955426a75402b121e4e8ad9faba5f378200 Mon Sep 17 00:00:00 2001 From: Fabian Weber Date: Thu, 18 Jul 2019 14:56:03 +0200 Subject: [PATCH 15/18] revert to refresh token --- scripts/publish.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/publish.sh b/scripts/publish.sh index 1a522e6062..7cae142646 100755 --- a/scripts/publish.sh +++ b/scripts/publish.sh @@ -1,3 +1,4 @@ #!/bin/sh +ACCESS_TOKEN=$(curl "https://www.googleapis.com/oauth2/v4/token" -d "client_id=${GAPI_CLIENT_ID}&client_secret=${GAPI_CLIENT_SECRET}&refresh_token=${GAPI_REFRESH_TOKEN}&grant_type=refresh_token" | jq -r .access_token) curl -H "Authorization: Bearer ${ACCESS_TOKEN}" -H "x-goog-api-version: 2" -X PUT -T $1 -v "https://www.googleapis.com/upload/chromewebstore/v1.1/items/${APP_ID}" \ No newline at end of file From f1edead0f9fb936fcac0a9c45dc99388df39bbe0 Mon Sep 17 00:00:00 2001 From: Fabian Weber Date: Thu, 18 Jul 2019 14:58:54 +0200 Subject: [PATCH 16/18] reenable normal ci jobs --- .circleci/config.yml | 63 +++++++++++++++++++++++--------------------- 1 file changed, 33 insertions(+), 30 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index b687462c72..968865be11 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -145,35 +145,35 @@ jobs: workflows: version: 2 - # build-and-deploy: - # jobs: - # # Static checks before - # - pendingUpdated: - # filters: - # branches: - # ignore: - # - release - # - master - - # - security: - # filters: - # branches: - # ignore: release - - # - lint: - # filters: - # branches: - # ignore: release - - # - testUnit: - # filters: - # branches: - # ignore: release - - # - testE2E: - # filters: - # branches: - # ignore: release + build-and-deploy: + jobs: + # Static checks before + - pendingUpdated: + filters: + branches: + ignore: + - release + - master + + - security: + filters: + branches: + ignore: release + + - lint: + filters: + branches: + ignore: release + + - testUnit: + filters: + branches: + ignore: release + + - testE2E: + filters: + branches: + ignore: release releaseManually: jobs: @@ -190,4 +190,7 @@ workflows: only: master publish: jobs: - - publish + - publish: + filters: + branches: + only: master From 8053a7d4096a8a9cbef84bc3a45a3cf7564dc91c Mon Sep 17 00:00:00 2001 From: Fabian Date: Thu, 18 Jul 2019 16:48:49 +0200 Subject: [PATCH 17/18] Update package.json Co-Authored-By: Jordan Bibla --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 612a67203e..74b2ff288e 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "lunie-browser-extension", "version": "1.0.0", - "description": "A browser extensio to manage keys and sign online", + "description": "A browser extension to securely manage accounts and addresses, for use with Lunie.io.", "author": "fabian@lunie.io", "licenses": [ { From 20e039b263ffa7231260bc624db806df2f46bb26 Mon Sep 17 00:00:00 2001 From: Fabian Date: Thu, 18 Jul 2019 16:50:44 +0200 Subject: [PATCH 18/18] Update package.json --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 74b2ff288e..2609666c32 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "lunie-browser-extension", "version": "1.0.0", "description": "A browser extension to securely manage accounts and addresses, for use with Lunie.io.", - "author": "fabian@lunie.io", + "author": "Lunie (https://lunie.io)", "licenses": [ { "type": "Apache-2"