config: Update 6 and remove 1 files
Some checks failed
Test and Publish Templates / test-and-publish (push) Failing after 16s
Some checks failed
Test and Publish Templates / test-and-publish (push) Failing after 16s
This commit is contained in:
34
publish.sh
34
publish.sh
@@ -96,6 +96,26 @@ fi
|
||||
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"
|
||||
info "dshash downloaded successfully"
|
||||
else
|
||||
DSHASH_BIN="dshash"
|
||||
fi
|
||||
|
||||
# Package and upload each template
|
||||
for TEMPLATE in $TEMPLATES_TO_PUBLISH; do
|
||||
if [ ! -f "$TEMPLATE/install.sh" ]; then
|
||||
@@ -115,26 +135,26 @@ for TEMPLATE in $TEMPLATES_TO_PUBLISH; do
|
||||
SIZE=$(du -h "$TARBALL" | cut -f1)
|
||||
info "Created $TEMPLATE.tgz ($SIZE)"
|
||||
|
||||
# Calculate XXHash64 of the unpacked template contents
|
||||
info "Calculating XXHash64 for $TEMPLATE"
|
||||
XXHASH=$(find "$TEMPLATE" -type f -exec xxhsum -H64 {} \; | sort | xxhsum -H64 | cut -d' ' -f1)
|
||||
info "XXHash64 for $TEMPLATE: $XXHASH"
|
||||
# Calculate SHA256 hash of the template directory
|
||||
info "Calculating SHA256 for $TEMPLATE"
|
||||
SHA256_HASH=$("$DSHASH_BIN" "$TEMPLATE")
|
||||
info "SHA256 for $TEMPLATE: $SHA256_HASH"
|
||||
|
||||
# Upload to templates.dropshell.app using sos
|
||||
info "Uploading $TEMPLATE to templates.dropshell.app"
|
||||
|
||||
# Always upload with :latest tag
|
||||
sos upload templates.dropshell.app "$TARBALL" "${TEMPLATE}:latest" --metadata "templateXXHash64=$XXHASH" || die "Failed to upload $TEMPLATE:latest"
|
||||
sos upload templates.dropshell.app "$TARBALL" "${TEMPLATE}:latest" --metadata "unpackedhash=$SHA256_HASH" || die "Failed to upload $TEMPLATE:latest"
|
||||
info "Uploaded ${TEMPLATE}:latest"
|
||||
|
||||
# Also upload with specific version tag
|
||||
sos upload templates.dropshell.app "$TARBALL" "${TEMPLATE}:${VERSION}" --metadata "templateXXHash64=$XXHASH" || die "Failed to upload $TEMPLATE:${VERSION}"
|
||||
sos upload templates.dropshell.app "$TARBALL" "${TEMPLATE}:${VERSION}" --metadata "unpackedhash=$SHA256_HASH" || die "Failed to upload $TEMPLATE:${VERSION}"
|
||||
info "Uploaded ${TEMPLATE}:${VERSION}"
|
||||
|
||||
# If we have a major version, also tag with major version only (e.g., v1)
|
||||
MAJOR_VERSION=$(echo "$VERSION" | cut -d. -f1)
|
||||
if [ -n "$MAJOR_VERSION" ]; then
|
||||
sos upload templates.dropshell.app "$TARBALL" "${TEMPLATE}:v${MAJOR_VERSION}" --metadata "templateXXHash64=$XXHASH" || die "Failed to upload $TEMPLATE:v${MAJOR_VERSION}"
|
||||
sos upload templates.dropshell.app "$TARBALL" "${TEMPLATE}:v${MAJOR_VERSION}" --metadata "unpackedhash=$SHA256_HASH" || die "Failed to upload $TEMPLATE:v${MAJOR_VERSION}"
|
||||
info "Uploaded ${TEMPLATE}:v${MAJOR_VERSION}"
|
||||
fi
|
||||
|
||||
|
Reference in New Issue
Block a user