🥅 better error handling
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
James Walker 2023-02-02 23:11:20 -05:00
parent 213ad94080
commit 8b3a587fa9
Signed by: walkah
GPG Key ID: 3C127179D6086E93

17
pin.sh
View File

@ -1,4 +1,6 @@
#!/bin/sh
#!/usr/bin/env bash
set -e
HOST=${PLUGIN_CLUSTER_HOST:-"/dns4/cluster.walkah.cloud"}
@ -10,16 +12,21 @@ root_cid=$(ipfs-cluster-ctl \
add \
--quieter \
--cid-version 1 \
--name "${PLUGIN_DOMAIN}" \
--name "$PLUGIN_DOMAIN" \
--recursive \
--local \
$PLUGIN_EXTRA_ARGS \
"$PLUGIN_PATH" )
"$PLUGIN_PATH" ) || {
echo "ipfs-cluster-ctl --host $HOST --basic-auth *** $PLUGIN_CLUSTER_ARGS add --quieter --local --wait --cid-version 1 --name $PLUGIN_DOMAIN --recursive $PLUGIN_PATH"
echo "FAILED to pin"
false
}
echo "Deployed: $root_cid"
if [ ! -x "$PLUGIN_CF_EMAIL" ]; then
export CF_API_EMAIL=$PLUGIN_CF_EMAIL
export CF_API_KEY=$PLUGIN_CF_APIKEY
dnslink-cloudflare -d $PLUGIN_DOMAIN -l "/ipfs/${root_cid}"
dnslink-cloudflare -d $PLUGIN_DOMAIN -l "/ipfs/${root_cid}" -r _dnslink
echo "Updated $PLUGIN_DOMAIN"
fi
echo "Deployed: $root_cid"