diff --git a/.gitea/workflows/manual-publish.yaml b/.gitea/workflows/manual-publish.yaml index b391ce2..a7bd3b5 100644 --- a/.gitea/workflows/manual-publish.yaml +++ b/.gitea/workflows/manual-publish.yaml @@ -40,6 +40,9 @@ jobs: # Install tar for packaging which tar || sudo apt-get update && sudo apt-get install -y tar + + # Install xxhash for calculating template hashes + which xxhsum || sudo apt-get update && sudo apt-get install -y xxhash - name: Bump versions if requested if: inputs.bump_version != 'none' diff --git a/.gitea/workflows/test-and-publish.yaml b/.gitea/workflows/test-and-publish.yaml index 75f346c..a0bd933 100644 --- a/.gitea/workflows/test-and-publish.yaml +++ b/.gitea/workflows/test-and-publish.yaml @@ -27,6 +27,9 @@ jobs: # Install tar for packaging which tar || sudo apt-get update && sudo apt-get install -y tar + + # Install xxhash for calculating template hashes + which xxhsum || sudo apt-get update && sudo apt-get install -y xxhash - name: Run tests run: | diff --git a/publish.sh b/publish.sh index d7d4f51..e196354 100755 --- a/publish.sh +++ b/publish.sh @@ -115,21 +115,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" + # 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" || die "Failed to upload $TEMPLATE:latest" + sos upload templates.dropshell.app "$TARBALL" "${TEMPLATE}:latest" --metadata "templateXXHash64=$XXHASH" || die "Failed to upload $TEMPLATE:latest" info "Uploaded ${TEMPLATE}:latest" # Also upload with specific version tag - sos upload templates.dropshell.app "$TARBALL" "${TEMPLATE}:${VERSION}" || die "Failed to upload $TEMPLATE:${VERSION}" + sos upload templates.dropshell.app "$TARBALL" "${TEMPLATE}:${VERSION}" --metadata "templateXXHash64=$XXHASH" || 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}" || die "Failed to upload $TEMPLATE:v${MAJOR_VERSION}" + sos upload templates.dropshell.app "$TARBALL" "${TEMPLATE}:v${MAJOR_VERSION}" --metadata "templateXXHash64=$XXHASH" || die "Failed to upload $TEMPLATE:v${MAJOR_VERSION}" info "Uploaded ${TEMPLATE}:v${MAJOR_VERSION}" fi