diff --git a/.circleci/config.yml b/.circleci/config.yml index c2ca30207b..b10d1bb931 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -63,8 +63,7 @@ jobs: - node_modules - run: yarn build << parameters.plugin >> - run: mkdir persist && zip -0 -r persist/plugin-<< parameters.plugin >>.zip dist - - run: sha1sum persist/plugin-<< parameters.plugin >>.zip - - run: ./apps/remix-ide/ci/publish_plugin.sh + - run: ./apps/remix-ide/ci/publish_plugin.sh << parameters.plugin >> - persist_to_workspace: root: . paths: diff --git a/apps/remix-ide/ci/publish_plugin.sh b/apps/remix-ide/ci/publish_plugin.sh index 08268ee7fd..b61eec8509 100755 --- a/apps/remix-ide/ci/publish_plugin.sh +++ b/apps/remix-ide/ci/publish_plugin.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash set -e - -yarn run tsc --version +sha1sum persist/plugin-$1.zip +npx ts-node apps/remix-ide/ci/publish_plugin.ts 328782397 alpha git clone git@github.com:ethereum/remix-plugins-directory.git \ No newline at end of file diff --git a/apps/remix-ide/ci/publish_plugin.ts b/apps/remix-ide/ci/publish_plugin.ts new file mode 100644 index 0000000000..928cbb0b7c --- /dev/null +++ b/apps/remix-ide/ci/publish_plugin.ts @@ -0,0 +1,30 @@ +import fetch from "node-fetch"; +(async () => { + const pluginsDirectory = 'https://raw.githubusercontent.com/ethereum/remix-plugins-directory/master/build/metadata.json' + const metadata = await fetch(pluginsDirectory, { method: 'GET' }) + + // get command line arguments + const args = process.argv.slice(2) + const pluginName = args[0] + const sha = args[1] + const build = args[2] + + if (!pluginName || !sha || !build) { + console.error('missing arguments') + process.exit(1) + } + + // search for the plugin in the metadata + const plugins = await metadata.json() + const plugin = plugins.find((p: any) => p.name === pluginName) + if (!plugin) { + console.error('plugin not found') + process.exit(1) + } + + // update the plugin + plugin.build = build + plugin.sha = sha + + console.log('publishing plugin', plugin, 'with sha', sha, 'and build', build) +})() \ No newline at end of file