Modified - [scripts] [smart-build] [artifacts] Renamed smart-build outputs to include the tag/ref and generated per-file SHA-256 checksums.
- 1 - I updated [`.smart-build.sh`](/config/workspace/gitea-dev/gitea/.smart-build.sh) so each build artifact is now written as `gitea-<tag-or-ref>-<os>-<platform><-sqlite>` with the original executable extension preserved, and each output also gets its own adjacent `.sha256` file generated with `sha256sum` or `shasum -a 256`. (cherry picked from commitc6f2b32f0b) (cherry picked from commitbff70ba3de)
This commit is contained in:
+43
-6
@@ -12,6 +12,37 @@ export NVM_DIR="$HOME/.nvm"
|
||||
# Forțează folosirea versiunii 22
|
||||
nvm use 22 > /dev/null 2>&1 || echo "⚠️ NVM nu a putut activa Node 22 automatically."
|
||||
|
||||
resolve_build_ref() {
|
||||
git describe --tags --exact-match 2>/dev/null || git describe --tags --always
|
||||
}
|
||||
|
||||
write_sha256_file() {
|
||||
local artifact_path="$1"
|
||||
local artifact_dir artifact_name
|
||||
|
||||
artifact_dir="$(dirname "$artifact_path")"
|
||||
artifact_name="$(basename "$artifact_path")"
|
||||
|
||||
if command -v sha256sum > /dev/null 2>&1; then
|
||||
(
|
||||
cd "$artifact_dir" || exit 1
|
||||
sha256sum "$artifact_name" > "$artifact_name.sha256"
|
||||
)
|
||||
return
|
||||
fi
|
||||
|
||||
if command -v shasum > /dev/null 2>&1; then
|
||||
(
|
||||
cd "$artifact_dir" || exit 1
|
||||
shasum -a 256 "$artifact_name" > "$artifact_name.sha256"
|
||||
)
|
||||
return
|
||||
fi
|
||||
|
||||
echo "❌ Neither sha256sum nor shasum is available for checksum generation."
|
||||
exit 1
|
||||
}
|
||||
|
||||
# --- 1. VERIFICARE INTEGRITATE ȘI CURĂȚARE CACHE INIȚIALĂ ---
|
||||
echo "🔍 Initialization checks..."
|
||||
|
||||
@@ -192,6 +223,10 @@ if [ -z "$BUILD_VARIANT" ]; then
|
||||
BUILD_VARIANT="default"
|
||||
fi
|
||||
|
||||
BUILD_REF="$(resolve_build_ref)"
|
||||
BUILD_REF="${BUILD_REF//\//-}"
|
||||
echo "🏷️ Build tag/reference: $BUILD_REF"
|
||||
|
||||
bindata_needs_update() {
|
||||
local source_dir="$1"
|
||||
local bindata_file="$2"
|
||||
@@ -238,14 +273,14 @@ ensure_bindata_assets
|
||||
mkdir -p dist
|
||||
for TARGET in "${TARGETS[@]}"; do
|
||||
IFS="/" read -r OS ARCH ARM_VER <<< "$TARGET"
|
||||
|
||||
|
||||
EXT="" && [ "$OS" == "windows" ] && EXT=".exe"
|
||||
SUFFIX="-$OS-$ARCH" && [ ! -z "$ARM_VER" ] && SUFFIX="-$OS-armv$ARM_VER"
|
||||
PLATFORM="$ARCH" && [ ! -z "$ARM_VER" ] && PLATFORM="armv$ARM_VER"
|
||||
VARIANT_SUFFIX="" && [ "$BUILD_VARIANT" == "sqlite" ] && VARIANT_SUFFIX="-sqlite"
|
||||
OUTPUT="dist/gitea$SUFFIX$VARIANT_SUFFIX$EXT"
|
||||
OUTPUT="dist/gitea-$BUILD_REF-$OS-$PLATFORM$VARIANT_SUFFIX$EXT"
|
||||
|
||||
echo "📦 Building for $OS/$ARCH ${ARM_VER:+(v$ARM_VER) }with TAGS=\"$BUILD_TAGS\"..."
|
||||
|
||||
|
||||
export GOOS=$OS
|
||||
export GOARCH=$ARCH
|
||||
export GOARM=$ARM_VER
|
||||
@@ -253,15 +288,17 @@ for TARGET in "${TARGETS[@]}"; do
|
||||
if [ "$BUILD_VARIANT" == "sqlite" ]; then
|
||||
export CGO_ENABLED=1
|
||||
fi
|
||||
|
||||
|
||||
if make build TAGS="$BUILD_TAGS"; then
|
||||
mv "gitea$EXT" "$OUTPUT"
|
||||
write_sha256_file "$OUTPUT"
|
||||
echo "✅ Created: $OUTPUT"
|
||||
echo "✅ Created: $OUTPUT.sha256"
|
||||
else
|
||||
echo "❌ Fail to build for $TARGET"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
unset GOOS GOARCH GOARM
|
||||
done
|
||||
|
||||
|
||||
Reference in New Issue
Block a user