-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathipfs-publish.sh
executable file
·37 lines (28 loc) · 1.34 KB
/
ipfs-publish.sh
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
#!/bin/bash
# Run the ipfs add command and capture the output
output=$(ipfs add -r dist)
# Extract the CID using awk or cut
cid=$(echo "$output" | tail -n 1 | awk '{print $2}')
echo "latest IPFS CID $cid"
# Run the ipfs name publish command with the extracted CID
ipfs name publish --key=orbitblog /ipfs/$cid
echo "IPFS name orbitblog updated with CID $cid"
# Update the vercel.json file with the new CID
# sed -i '' "s|/ipfs/[^\"}]*|/ipfs/$cid|g" vercel.json
# Execute the docker-compose command on the remote server
ssh [email protected] "docker-compose exec ipfs ipfs add $cid"
echo "IPFS CID $cid added to ipfs.le-space.de"
# Pin the CID to ipfs.le-space.de
ssh [email protected] "docker-compose exec ipfs ipfs pin add $cid"
echo "IPFS CID $cid pinned to ipfs.le-space.de"
ssh [email protected] "docker-compose exec ipfs ipfs pin add --follow follow /ipns/k51qzi5uqu5djjnnjgtviql86f19isjyz6azhw48ovgn22m6otstezp2ngfs8g"
echo "IPFS CID $cid published on ipfs.le-space.de and vercel.json updated"
# Get the current version from package.json
version=$(node -p "require('./package.json').version")
# Git commands
# git add vercel.json
git commit -m "Update IPFS CID to $cid for version $version"
git tag -a "v$version" -m "Version $version"
git push origin main
git push origin --tags
echo "Changes committed and pushed to GitHub. Tagged as v$version"