[CD] Deploy dotapps.io(IPFS version) more decentralized with Crust (#4933)
* Fix abnormal account type * Fix crust logo invisible * Add Crust Rococo V1 Endpoint * Upgrade to Crust Maxwell * Apply crust type package and add DCF provider * Change ipfs upload in a more decentralized way * Add CRUST_SEEDS env variable
This commit is contained in:
parent
89df9507df
commit
3fdee343c8
1
.github/workflows/push-master.yml
vendored
1
.github/workflows/push-master.yml
vendored
@ -21,6 +21,7 @@ jobs:
|
||||
env:
|
||||
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
|
||||
CF_API_TOKEN: ${{ secrets.CF_API_TOKEN }}
|
||||
CRUST_SEEDS: ${{ secrets.CRUST_SEEDS }}
|
||||
GH_PAGES_SRC: packages/apps/build
|
||||
GH_PAT: ${{ secrets.GH_PAT }}
|
||||
GH_RELEASE_GITHUB_API_TOKEN: ${{ secrets.GH_PAT }}
|
||||
|
||||
@ -67,6 +67,7 @@
|
||||
"@babel/core": "^7.13.10",
|
||||
"@babel/register": "^7.13.8",
|
||||
"@babel/runtime": "^7.13.10",
|
||||
"@crustio/crust-pin": "^0.0.1",
|
||||
"@pinata/sdk": "^1.1.13",
|
||||
"@polkadot/dev": "^0.62.7",
|
||||
"@polkadot/ts": "^0.3.62",
|
||||
|
||||
@ -3,6 +3,7 @@
|
||||
|
||||
const fs = require('fs');
|
||||
const pinataSDK = require('@pinata/sdk');
|
||||
const crustPin = require('@crustio/crust-pin').default;
|
||||
const cloudflare = require('dnslink-cloudflare');
|
||||
const execSync = require('@polkadot/dev/scripts/execSync.cjs');
|
||||
|
||||
@ -19,6 +20,7 @@ const PINMETA = { name: DOMAIN };
|
||||
|
||||
const repo = `https://${process.env.GH_PAT}@github.com/${process.env.GITHUB_REPOSITORY}.git`;
|
||||
const pinata = pinataSDK(process.env.PINATA_API_KEY, process.env.PINATA_SECRET_KEY);
|
||||
const crust = crustPin(process.env.CRUST_SEEDS);
|
||||
|
||||
function writeFiles (name, content) {
|
||||
[DST, SRC].forEach((root) =>
|
||||
@ -36,6 +38,7 @@ skip-checks: true"`);
|
||||
}
|
||||
|
||||
async function pin () {
|
||||
// 1. Pin on pinata
|
||||
const result = await pinata.pinFromFS(DST, { pinataMetadata: PINMETA });
|
||||
const url = `${GATEWAY}${result.IpfsHash}/`;
|
||||
const html = `<!DOCTYPE html>
|
||||
@ -58,6 +61,9 @@ async function pin () {
|
||||
writeFiles('pin.json', JSON.stringify(result));
|
||||
updateGh(result.IpfsHash);
|
||||
|
||||
// 2. Decentralized pin on Crust
|
||||
await crust.pin(result.IpfsHash);
|
||||
|
||||
console.log(`Pinned ${result.IpfsHash}`);
|
||||
|
||||
return result.IpfsHash;
|
||||
|
||||
13
yarn.lock
13
yarn.lock
@ -1412,7 +1412,17 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@crustio/type-definitions@npm:0.0.5":
|
||||
"@crustio/crust-pin@npm:^0.0.1":
|
||||
version: 0.0.1
|
||||
resolution: "@crustio/crust-pin@npm:0.0.1"
|
||||
dependencies:
|
||||
"@crustio/type-definitions": ^0.0.5
|
||||
"@polkadot/api": ^3.11.1
|
||||
checksum: 036cec0b77385b1ed0d8fa3fb91e8921b998a994ef1f45983911b473be4bedf259ae56babb581466bad588670a574580ce38d15ceeba35686ee4cc56312bdc4d
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@crustio/type-definitions@npm:0.0.5, @crustio/type-definitions@npm:^0.0.5":
|
||||
version: 0.0.5
|
||||
resolution: "@crustio/type-definitions@npm:0.0.5"
|
||||
dependencies:
|
||||
@ -14559,6 +14569,7 @@ fsevents@~2.1.2:
|
||||
"@babel/core": ^7.13.10
|
||||
"@babel/register": ^7.13.8
|
||||
"@babel/runtime": ^7.13.10
|
||||
"@crustio/crust-pin": ^0.0.1
|
||||
"@pinata/sdk": ^1.1.13
|
||||
"@polkadot/dev": ^0.62.7
|
||||
"@polkadot/ts": ^0.3.62
|
||||
|
||||
Loading…
Reference in New Issue
Block a user