From 1ca01137b554b4cf3f67998f1b0733f8f75c23a6 Mon Sep 17 00:00:00 2001 From: Your Name Date: Tue, 2 Sep 2025 18:57:31 +1200 Subject: [PATCH] config: Update 6 and remove 1 files --- .gitea/workflows/manual-publish.yaml | 87 ---------------------------- caddy/_volumes.sh | 0 publish.sh | 34 ++++++++--- simple-object-server/_volumes.sh | 0 squashkiwi/_paths.sh | 0 static-website/_paths.sh | 0 versions.json | 1 - 7 files changed, 27 insertions(+), 95 deletions(-) delete mode 100644 .gitea/workflows/manual-publish.yaml mode change 100644 => 100755 caddy/_volumes.sh mode change 100644 => 100755 simple-object-server/_volumes.sh mode change 100644 => 100755 squashkiwi/_paths.sh mode change 100644 => 100755 static-website/_paths.sh diff --git a/.gitea/workflows/manual-publish.yaml b/.gitea/workflows/manual-publish.yaml deleted file mode 100644 index a7bd3b5..0000000 --- a/.gitea/workflows/manual-publish.yaml +++ /dev/null @@ -1,87 +0,0 @@ -name: Manual Publish Templates - -on: - workflow_dispatch: - inputs: - templates: - description: 'Templates to publish (space-separated, or "all")' - required: false - default: 'all' - type: string - bump_version: - description: 'Bump version type (major, minor, patch, or none)' - required: false - default: 'none' - type: choice - options: - - none - - patch - - minor - - major - -jobs: - publish: - runs-on: ubuntu-latest - - steps: - - name: Checkout code - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - - name: Install dependencies - run: | - # Install sos tool for uploading - curl -o /tmp/sos https://getbin.xyz/sos:latest && chmod +x /tmp/sos - sudo mv /tmp/sos /usr/local/bin/sos - - # Install jq for JSON parsing - which jq || sudo apt-get update && sudo apt-get install -y jq - - # 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' - run: | - chmod +x bump-version.sh - if [ "${{ inputs.templates }}" == "all" ]; then - ./bump-version.sh --all ${{ inputs.bump_version }} - else - for template in ${{ inputs.templates }}; do - ./bump-version.sh "$template" ${{ inputs.bump_version }} - done - fi - - # Show updated versions - echo "Updated versions:" - cat versions.json - - - name: Run tests - run: | - chmod +x test.sh - ./test.sh - - - name: Publish templates - run: | - chmod +x publish.sh - - if [ "${{ inputs.templates }}" == "all" ]; then - SOS_WRITE_TOKEN=${{ secrets.SOS_WRITE_TOKEN }} \ - ./publish.sh --all - else - SOS_WRITE_TOKEN=${{ secrets.SOS_WRITE_TOKEN }} \ - ./publish.sh ${{ inputs.templates }} - fi - - - name: Commit version changes - if: inputs.bump_version != 'none' - run: | - git config --local user.email "actions@gitea.com" - git config --local user.name "Gitea Actions" - git add versions.json - git diff --staged --quiet || git commit -m "chore: bump version(s) via manual publish" - git push \ No newline at end of file diff --git a/caddy/_volumes.sh b/caddy/_volumes.sh old mode 100644 new mode 100755 diff --git a/publish.sh b/publish.sh index e196354..c570c9e 100755 --- a/publish.sh +++ b/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 diff --git a/simple-object-server/_volumes.sh b/simple-object-server/_volumes.sh old mode 100644 new mode 100755 diff --git a/squashkiwi/_paths.sh b/squashkiwi/_paths.sh old mode 100644 new mode 100755 diff --git a/static-website/_paths.sh b/static-website/_paths.sh old mode 100644 new mode 100755 diff --git a/versions.json b/versions.json index 7a870f8..4432442 100644 --- a/versions.json +++ b/versions.json @@ -2,7 +2,6 @@ "caddy": "1.0.0", "gitea-runner-docker": "1.0.0", "simple-object-server": "1.0.0", - "squashkiwi": "1.0.0", "static-website": "1.0.0", "watchtower": "1.0.0" } \ No newline at end of file