Update publish.sh
All checks were successful
Test and Publish Templates / test-and-publish (push) Successful in 30s
All checks were successful
Test and Publish Templates / test-and-publish (push) Successful in 30s
This commit is contained in:
28
publish.sh
28
publish.sh
@@ -5,6 +5,17 @@ set -e
|
||||
SCRIPT_DIR=$(dirname "$0")
|
||||
cd "$SCRIPT_DIR"
|
||||
|
||||
# Detect architecture
|
||||
ARCH=$(uname -m)
|
||||
if [ "$ARCH" = "x86_64" ]; then
|
||||
ARCH="x86_64"
|
||||
elif [ "$ARCH" = "aarch64" ] || [ "$ARCH" = "arm64" ]; then
|
||||
ARCH="aarch64"
|
||||
else
|
||||
echo "WARNING: Unknown architecture: $ARCH, defaulting to x86_64" >&2
|
||||
ARCH="x86_64"
|
||||
fi
|
||||
|
||||
function die() {
|
||||
echo "ERROR: $1" >&2
|
||||
exit 1
|
||||
@@ -64,6 +75,10 @@ done
|
||||
# Check if SOS_WRITE_TOKEN is set
|
||||
[[ -n $SOS_WRITE_TOKEN ]] || die "SOS_WRITE_TOKEN environment variable not set"
|
||||
|
||||
# Create temporary directory for packaging
|
||||
TMPDIR=$(mktemp -d)
|
||||
trap "rm -rf $TMPDIR" EXIT
|
||||
|
||||
# Always download the latest sos to ensure compatibility
|
||||
info "Downloading latest sos utility..."
|
||||
SOS_BIN="$TMPDIR/sos"
|
||||
@@ -96,22 +111,9 @@ if [ -z "$TEMPLATES_TO_PUBLISH" ]; then
|
||||
die "No templates found to publish"
|
||||
fi
|
||||
|
||||
# Create temporary directory for packaging
|
||||
TMPDIR=$(mktemp -d)
|
||||
trap "rm -rf $TMPDIR" EXIT
|
||||
|
||||
# Download dshash if not available
|
||||
if ! which dshash >/dev/null 2>&1; then
|
||||
info "Downloading dshash utility..."
|
||||
ARCH=$(uname -m)
|
||||
if [ "$ARCH" = "x86_64" ]; then
|
||||
ARCH="x86_64"
|
||||
elif [ "$ARCH" = "aarch64" ] || [ "$ARCH" = "arm64" ]; then
|
||||
ARCH="aarch64"
|
||||
else
|
||||
die "Unsupported architecture: $ARCH"
|
||||
fi
|
||||
|
||||
DSHASH_BIN="$TMPDIR/dshash"
|
||||
curl -L -o "$DSHASH_BIN" "https://getbin.xyz/dshash:latest-$ARCH" 2>/dev/null || die "Failed to download dshash"
|
||||
chmod +x "$DSHASH_BIN"
|
||||
|
Reference in New Issue
Block a user