From bd892328070957e6fcc9f5eefcfbec758170ff31 Mon Sep 17 00:00:00 2001 From: filip mertens Date: Fri, 24 Mar 2023 14:45:11 +0100 Subject: [PATCH] remove publish scripts --- .circleci/config.yml | 1 - apps/remix-ide/ci/publish_plugin.sh | 17 ---- apps/remix-ide/ci/publish_plugin.ts | 125 ---------------------------- 3 files changed, 143 deletions(-) delete mode 100755 apps/remix-ide/ci/publish_plugin.sh delete mode 100644 apps/remix-ide/ci/publish_plugin.ts diff --git a/.circleci/config.yml b/.circleci/config.yml index 8fa877f28e..2b15bf573e 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -67,7 +67,6 @@ jobs: - node_modules - run: yarn nx build << parameters.plugin >> --configuration=production - run: mkdir persist && zip -0 -r persist/plugin-<< parameters.plugin >>.zip dist - - 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 deleted file mode 100755 index 3267f0c973..0000000000 --- a/apps/remix-ide/ci/publish_plugin.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/usr/bin/env bash - -set -e - -#gh pr comment --body "testing" - -git config --global user.name "$COMMIT_AUTHOR" -git config --global user.email "$COMMIT_AUTHOR_EMAIL" - -HASH=$(sha1sum persist/plugin-$1.zip | cut -d " " -f 1) -# unzip persist/plugin-$1.zip -# ls -la dist/apps/plugin-$1 - -git clone git@github.com:ethereum/remix-plugins-directory.git -npx ts-node apps/remix-ide/ci/publish_plugin.ts $1 $HASH alpha - - diff --git a/apps/remix-ide/ci/publish_plugin.ts b/apps/remix-ide/ci/publish_plugin.ts deleted file mode 100644 index df0b077231..0000000000 --- a/apps/remix-ide/ci/publish_plugin.ts +++ /dev/null @@ -1,125 +0,0 @@ -import fetch from "node-fetch"; -import fs from "fs"; -import IpfsHttpClient from 'ipfs-http-client' -import * as util from 'util' -import * as child_process from 'child_process' - -(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] - let sha_field = 'sha_' + build - let url_field = 'url_' + build - - if (build === 'live') { - sha_field = 'sha' - url_field = 'url' - } - - console.log(process.argv) - - if (!pluginName || !sha || !build) { - console.error('missing arguments') - process.exit(1) - } - - // search for the plugin in the metadata - const plugins = await metadata.json() - let plugin = plugins.find((p: any) => p.name === pluginName) - let profileJSON: any = null - try { - profileJSON = JSON.parse(fs.readFileSync(`apps/${pluginName}/profile.json`, 'utf8')) - } catch (e) { - console.log('local profile.json not found') - } - - if (!plugin) { - console.error('plugin not found in the directory, attempting to create it...') - if (!profileJSON) { - console.error('create a profile.json file in the plugin folder') - process.exit(1) - } - plugin = profileJSON - } - - // check if build and sha exist - if (plugin[url_field] && plugin[sha_field]) { - // compare the sha - if (plugin[sha_field] === sha) { - console.log('plugin already published') - process.exit(0) - } - } - - // update the plugin - - plugin[sha_field] = sha - - // publish the plugin - const host = 'ipfs.infura.io' - const projectId = process.env.infura_project_id - const projectSecret = process.env.infura_project_secret - const auth = 'Basic ' + Buffer.from(projectId + ':' + projectSecret).toString('base64') - - const ipfs = IpfsHttpClient({ - port: 5001, host, protocol: 'https', headers: { - authorization: auth - } - }) - const { globSource } = IpfsHttpClient - const folder = `dist/apps/${pluginName}` - - const result = await ipfs.add(globSource(folder, { recursive: true }), { pin: true }) - const hash = result.cid.toString() - const url = `https://ipfs-cluster.ethdevops.io/ipfs/${hash}` - plugin[url_field] = url - console.log('ipfs hash', hash, 'url', url) - console.log('publishing plugin', plugin, 'with sha', sha, 'and build', build) - - // write the profile.json file - const plugin_directory_path = 'remix-plugins-directory/plugins/' - - // create the plugin directory if it doesn't exist - try { - fs.statSync(plugin_directory_path + pluginName).isDirectory() - } catch (e) { - console.log('creating plugin directory') - fs.mkdirSync(plugin_directory_path + pluginName) - } - // write the profile.json file - fs.writeFileSync(plugin_directory_path + pluginName + '/profile.json', JSON.stringify(plugin, null, 2)) - - // read the profile.json file - const content = fs.readFileSync(plugin_directory_path + pluginName + '/profile.json') - console.log('profile.json', content.toString()) - - - // create pull request - const promisifyExec = util.promisify(child_process.exec) - let out = await promisifyExec('git status', { - cwd: process.cwd() + '/remix-plugins-directory' - }) - console.log(out) - - out = await promisifyExec(`git checkout -b ${pluginName}${sha}`, { - cwd: process.cwd() + '/remix-plugins-directory' - }) - out = await promisifyExec('git add .', { - cwd: process.cwd() + '/remix-plugins-directory' - }) - out = await promisifyExec(`git commit -m "update profile ${pluginName} with url ${url}"`, { - cwd: process.cwd() + '/remix-plugins-directory' - }) - - out = await promisifyExec(`git push --set-upstream origin ${pluginName}${sha}`, { - cwd: process.cwd() + '/remix-plugins-directory' - }) - - console.log(out) - -})() \ No newline at end of file