refactor: use bash variable expansion for dev- prefix handling

This commit is contained in:
overtrue
2025-07-12 10:41:08 +08:00
parent 238a016242
commit c57b4be1c7
3 changed files with 18 additions and 9 deletions

View File

@@ -53,11 +53,14 @@ RUN if [ -n "$VERSION" ]; then \
*) echo "Unsupported architecture: ${TARGETARCH}" && exit 1 ;; \
esac; \
\
# Determine download path and filename
if [ "${BUILD_TYPE}" = "development" ]; then \
# Handle VERSION with potential dev- prefix using variable expansion
if [[ "$VERSION" == dev-* ]]; then \
# Remove dev- prefix if present
CLEAN_VERSION="${VERSION#dev-}"; \
DOWNLOAD_PATH="artifacts/rustfs/dev"; \
FILENAME="rustfs-linux-${ARCH}-dev-${VERSION}.zip"; \
FILENAME="rustfs-linux-${ARCH}-dev-${CLEAN_VERSION}.zip"; \
else \
# VERSION is a release version
DOWNLOAD_PATH="artifacts/rustfs/release"; \
FILENAME="rustfs-linux-${ARCH}-v${VERSION}.zip"; \
fi; \

View File

@@ -73,11 +73,14 @@ RUN if [ -n "$VERSION" ]; then \
*) echo "Unsupported architecture: ${TARGETARCH}" && exit 1 ;; \
esac; \
\
# Determine download path and filename
if [ "${BUILD_TYPE}" = "development" ]; then \
# Handle VERSION with potential dev- prefix using variable expansion
if [[ "$VERSION" == dev-* ]]; then \
# Remove dev- prefix if present
CLEAN_VERSION="${VERSION#dev-}"; \
DOWNLOAD_PATH="artifacts/rustfs/dev"; \
FILENAME="rustfs-linux-${ARCH}-dev-${VERSION}.zip"; \
FILENAME="rustfs-linux-${ARCH}-dev-${CLEAN_VERSION}.zip"; \
else \
# VERSION is a release version
DOWNLOAD_PATH="artifacts/rustfs/release"; \
FILENAME="rustfs-linux-${ARCH}-v${VERSION}.zip"; \
fi; \

View File

@@ -53,11 +53,14 @@ RUN if [ -n "$VERSION" ]; then \
*) echo "Unsupported architecture: ${TARGETARCH}" && exit 1 ;; \
esac; \
\
# Determine download path and filename
if [ "${BUILD_TYPE}" = "development" ]; then \
# Handle VERSION with potential dev- prefix using variable expansion
if [[ "$VERSION" == dev-* ]]; then \
# Remove dev- prefix if present
CLEAN_VERSION="${VERSION#dev-}"; \
DOWNLOAD_PATH="artifacts/rustfs/dev"; \
FILENAME="rustfs-linux-${ARCH}-dev-${VERSION}.zip"; \
FILENAME="rustfs-linux-${ARCH}-dev-${CLEAN_VERSION}.zip"; \
else \
# VERSION is a release version
DOWNLOAD_PATH="artifacts/rustfs/release"; \
FILENAME="rustfs-linux-${ARCH}-v${VERSION}.zip"; \
fi; \