-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeploy.sh
More file actions
executable file
·47 lines (33 loc) · 1.24 KB
/
deploy.sh
File metadata and controls
executable file
·47 lines (33 loc) · 1.24 KB
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
46
47
#!/bin/bash
# Exit script if any command fails
set -e
echo "Installing dependencies..."
npm install
echo "Creating .env file..."
touch .env
# Prompt user for Ganache mnemonic
read -p "Enter your Ganache mnemonic: " mnemonic
# Prompt user for Pinata JWT
read -p "Enter your Pinata JWT: " pinata_jwt
# Prompt user for path to file to upload
echo "Select the file you want to upload..."
file_path=$(python3 -c "import tkinter as tk; from tkinter import filedialog; tk.Tk().withdraw(); print(filedialog.askopenfilename())")
# Prompt user for file description
read -p "Enter a description for the file: " description
# Write the variables to .env
echo "Saving credentials to .env..."
echo "MNEMONIC=\"$mnemonic\"" > .env
echo "PINATA_JWT=\"$pinata_jwt\"" >> .env
echo "FILE_PATH=\"$file_path\"" >> .env
echo "DESCRIPTION=\"$description\"" >> .env
echo "Cleaning previous builds..."
npx hardhat clean
echo "Compiling smart contracts..."
npx hardhat compile
echo "Deploying smart contracts..."
npx hardhat run scripts/deploy.js --network ganache
echo "Uploading file to IPFS..."
npx hardhat run scripts/storeCID.js --network ganache
echo "Retrieving stored CIDs..."
npx hardhat run scripts/getUserCIDs.js --network ganache
echo "All steps completed successfully!"