-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.js
45 lines (40 loc) · 1.41 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
const deploy = require("ipfs-deploy/src");
const core = require("@actions/core");
async function main() {
try {
const deployDir = core.getInput("deploy-dir");
const pinningService = core.getInput("pinning-service");
const pinataAPIKey = core.getInput("pinata-api-key");
const pinataSecretAPIKey = core.getInput("pinata-secret-api-key");
const cloudflareAPIEmail = core.getInput("cloudflare-api-email");
const cloudflareAPIKey = core.getInput("cloudflare-api-key");
const cloudflareAPIToken = core.getInput("cloudflare-api-token");
const cloudflareZone = core.getInput("cloudflare-zone");
const cloudflareRecord = core.getInput("cloudflare-record");
core.info(`Deploying to ${pinningService} & updating Cloudflare DNS`);
const ipfsHash = await deploy({
publicDirPath: deployDir,
remotePinners: [pinningService],
dnsProviders: ['cloudflare'],
credentials: {
pinata: {
apiKey: pinataAPIKey,
secretApiKey: pinataSecretAPIKey
},
cloudflare: {
apiEmail: cloudflareAPIEmail,
apiKey: cloudflareAPIKey,
apiToken: cloudflareAPIToken,
zone: cloudflareZone,
record: cloudflareRecord
}
},
open: false,
copyHttpGatewayUrlToClipboard: false
});
core.setOutput("ipfs-hash", ipfsHash);
} catch (error) {
core.setFailed(error.message);
}
}
main();