This is an automated email from the ASF dual-hosted git repository. piotr pushed a commit to branch release_script in repository https://gitbox.apache.org/repos/asf/iggy.git
commit 7afb230469bc55e778fb0d612cb648056aad8312 Author: spetz <[email protected]> AuthorDate: Mon Dec 1 16:51:58 2025 +0100 chore(repo): improve release script --- scripts/prepare-release.sh | 172 ++++++++------------------------------------- 1 file changed, 31 insertions(+), 141 deletions(-) diff --git a/scripts/prepare-release.sh b/scripts/prepare-release.sh index 83e6d46fb..a40991d85 100755 --- a/scripts/prepare-release.sh +++ b/scripts/prepare-release.sh @@ -1,5 +1,3 @@ -#!/bin/bash - #!/usr/bin/env bash # Licensed to the Apache Software Foundation (ASF) under one @@ -19,37 +17,34 @@ # specific language governing permissions and limitations # under the License. -# This script is used to prepare the release artifacts for the Apache Iggy project. +# This script creates reproducible source release archives for Apache Iggy. +# It uses git archive which produces identical output across all platforms. set -euo pipefail -# Determine tar command based on OS -TAR_CMD="tar" -OS_NAME=$(uname) - -if [[ "$OS_NAME" == "Darwin" ]]; then - if command -v gtar >/dev/null 2>&1; then - TAR_CMD="gtar" - else - echo "❌ GNU tar (gtar) is required on macOS. Install it with: brew install gnu-tar" - exit 1 - fi -fi - if [ "$(basename "$PWD")" == "scripts" ]; then cd .. fi -SRC_DIR="./" -RELEASE_DIR="iggy_release" -TEMP_DIR="iggy_release_tmp" +# Ensure we're in a git repository +if ! git rev-parse --git-dir > /dev/null 2>&1; then + echo "Error: Must be run from within the git repository" + exit 1 +fi -rm -rf "$TEMP_DIR" +RELEASE_DIR="iggy_release" rm -rf "$RELEASE_DIR" -mkdir -p "$TEMP_DIR" mkdir -p "$RELEASE_DIR" -RELEASE_FILES=( +# Get version from Cargo.toml +VERSION=$(grep '^version' "core/server/Cargo.toml" | head -n 1 | cut -d '"' -f2) + +echo "Preparing release for version: $VERSION" + +ARCHIVE_NAME="iggy-${VERSION}-incubating-src.tar.gz" + +# Files/directories to include in the release +RELEASE_PATHS=( "Cargo.lock" "Cargo.toml" "DEPENDENCIES.md" @@ -59,9 +54,6 @@ RELEASE_FILES=( "NOTICE" "docker-compose.yml" "justfile" -) - -RELEASE_DIRS=( "bdd" "core" "examples" @@ -72,125 +64,23 @@ RELEASE_DIRS=( "web" ) -IGNORED_FILES=( - ".DS_Store" - ".gitignore" -) - -IGNORED_DIRS=( - "assets" - "target" - "node_modules" - "pkg" - "build" - "out" - "dist" - "bin" - "obj" - "__pycache__" - ".elixir_ls" - ".tox" - ".eggs" - ".venv" - ".svelte-kit" - ".config" - ".github" - ".idea" - ".vscode" - ".zed" -) - -for file in "${RELEASE_FILES[@]}"; do - cp "$SRC_DIR/$file" "$TEMP_DIR/" -done - -shopt -s dotglob nullglob - -for dir in "${RELEASE_DIRS[@]}"; do - src="$SRC_DIR/$dir" - dest="$TEMP_DIR/$dir" - - [ -d "$src" ] || continue - mkdir -p "$dest" - - for item in "$src"/*; do - name=$(basename "$item") - - if [[ "$dir" == "web" ]]; then - if [ -d "$item" ]; then - for ignored in "${IGNORED_DIRS[@]}"; do - if [[ "$name" == "$ignored" ]]; then - continue 2 - fi - done - fi - - if [ -f "$item" ]; then - for ignored_file in "${IGNORED_FILES[@]}"; do - if [[ "$name" == "$ignored_file" ]]; then - continue 2 - fi - done - fi - fi - - if [[ "$dir" == "foreign" && -d "$item" ]]; then - sdk=$(basename "$item") - mkdir -p "$dest/$sdk" - - for sdk_item in "$item"/*; do - sdk_name=$(basename "$sdk_item") - - if [ -d "$sdk_item" ]; then - for ignored in "${IGNORED_DIRS[@]}"; do - if [[ "$sdk_name" == "$ignored" ]]; then - continue 2 - fi - done - fi - - if [ -f "$sdk_item" ]; then - for ignored_file in "${IGNORED_FILES[@]}"; do - if [[ "$sdk_name" == "$ignored_file" ]]; then - continue 2 - fi - done - fi - - cp -r "$sdk_item" "$dest/$sdk/" - done - - continue - fi - - cp -r "$item" "$dest/" - done -done - -shopt -u dotglob nullglob - - -VERSION=$(grep '^version' "$TEMP_DIR/core/server/Cargo.toml" | head -n 1 | cut -d '"' -f2) - -echo "Preparing release for version: $VERSION" - -ARCHIVE_NAME="iggy-${VERSION}-incubating-src.tar.gz" - -GZIP=-n "$TAR_CMD" --sort=name \ - --mtime='UTC 2020-01-01' \ - --owner=0 --group=0 --numeric-owner \ - -czf "$ARCHIVE_NAME" -C "$TEMP_DIR" . - +# Use git archive for reproducible output +# --prefix adds a top-level directory to the archive +# --worktree-attributes respects .gitattributes export-ignore +git archive \ + --format=tar.gz \ + --prefix="iggy-${VERSION}-incubating-src/" \ + -o "$RELEASE_DIR/$ARCHIVE_NAME" \ + HEAD \ + "${RELEASE_PATHS[@]}" + +# Generate checksum +cd "$RELEASE_DIR" CHECKSUM_FILE="${ARCHIVE_NAME}.sha512" sha512sum "$ARCHIVE_NAME" > "$CHECKSUM_FILE" -rm -rf "$TEMP_DIR" - echo "Release directory: $RELEASE_DIR" echo "SHA-512 checksum:" cat "$CHECKSUM_FILE" -echo "✔ Archive created: $ARCHIVE_NAME" -echo "✔ Checksum saved to: $CHECKSUM_FILE" - -mv "$ARCHIVE_NAME" "$RELEASE_DIR/" -mv "$CHECKSUM_FILE" "$RELEASE_DIR/" +echo "Archive created: $ARCHIVE_NAME" +echo "Checksum saved to: $CHECKSUM_FILE"
