test publish

publishpplugins
filip mertens 2 years ago
parent d8654db472
commit f0194886f9
  1. 24
      apps/remix-ide/ci/publish_plugin.ts

@ -1,6 +1,6 @@
import fetch from "node-fetch"; import fetch from "node-fetch";
import fs from "fs"; import fs from "fs";
import ipfsClient from 'ipfs-http-client' import IpfsHttpClient from 'ipfs-http-client'
(async () => { (async () => {
const pluginsDirectory = 'https://raw.githubusercontent.com/ethereum/remix-plugins-directory/master/build/metadata.json' const pluginsDirectory = 'https://raw.githubusercontent.com/ethereum/remix-plugins-directory/master/build/metadata.json'
@ -60,17 +60,19 @@ import ipfsClient from 'ipfs-http-client'
console.log('publishing plugin', plugin, 'with sha', sha, 'and build', build) console.log('publishing plugin', plugin, 'with sha', sha, 'and build', build)
// publish the plugin // publish the plugin
const globalIPFSConfig = { const host = 'ipfs.infura.io'
host: 'ipfs-cluster.ethdevops.io', const projectId = process.env.infura_project_id
port: 5001, const projectSecret = process.env.infura_project_secret
protocol: 'https', const auth = 'Basic ' + Buffer.from(projectId + ':' + projectSecret).toString('base64')
ipfsurl: 'https://ipfs.io/ipfs/'
} const ipfs = IpfsHttpClient({ port: 5001, host, protocol: 'https', headers: {
const ipfs = ipfsClient(globalIPFSConfig) authorization: auth
const { globSource } = ipfsClient } })
const { globSource } = IpfsHttpClient
const folder = `apps/${pluginName}` const folder = `apps/${pluginName}`
console.log(ipfs) const result = await ipfs.add(globSource(folder, { recursive: true}), { pin: true })
let result = await ipfs.add(globSource(folder, { recursive: true}), { pin: true }) const hash = result.cid.toString()
console.log('ipfs hash', hash)
})() })()
Loading…
Cancel
Save