update upload file struct

This commit is contained in:
partisan 2024-08-03 22:30:57 +02:00
parent e2872589a4
commit 5fd9a5f45f

View file

@ -68,16 +68,10 @@ fi
# Split the target into its components
IFS='-' read -r COMPONENT ARCH RELEASE PLATFORM <<< "$TARGET"
# Determine the upload directory based on the target
UPLOAD_DIR="$COMPONENT/$ARCH/$RELEASE/$PLATFORM"
# Construct the remote directory path
REMOTE_DIR="/home/frs/project/$SF_PROJECT/$UPLOAD_DIR"
# Handle versioning
if [ -z "$VERSION" ]; then
if [[ "$RELEASE" == "nightly" ]]; then
VERSION=$(date +"%Y%m%d")
VERSION=$(date +"%Y-%m-%d")
elif [[ "$RELEASE" == "stable" ]]; then
CURRENT_VERSION=$(grep -oP '(?<="'"$COMPONENT"'": ")([^"]*)' packages.json)
if [ -n "$CURRENT_VERSION" ]; then
@ -98,6 +92,24 @@ fi
jq --arg comp "$COMPONENT" --arg ver "$VERSION" '.[$comp] = $ver' packages.json > packages_temp.json && mv packages_temp.json packages.json
# Determine the upload directory based on the target and version
if [[ "$RELEASE" == "nightly" ]]; then
if [[ "$VERSION" == $(date +"%Y-%m-%d") ]]; then
UPLOAD_DIR="$COMPONENT/$ARCH/$RELEASE/latest"
else
UPLOAD_DIR="$COMPONENT/$ARCH/$RELEASE/$VERSION"
fi
elif [[ "$RELEASE" == "stable" ]]; then
if [[ "$VERSION" =~ ^[0-9]+\.[0-9]+$ ]]; then
UPLOAD_DIR="$COMPONENT/$ARCH/$RELEASE/$VERSION"
else
UPLOAD_DIR="$COMPONENT/$ARCH/$RELEASE/latest"
fi
fi
# Construct the remote directory path
REMOTE_DIR="/home/frs/project/$SF_PROJECT/$UPLOAD_DIR"
# Handle compression if specified
if [ "$COMPRESS" = true ]; then
COMPRESSED_FILE="/tmp/${TARGET}.tar.gz"