chore: prepare v2.0.0-rc.3

This commit is contained in:
Jacky 2025-02-24 10:37:40 +08:00
parent 09fcb1304a
commit 082ccc18bc
No known key found for this signature in database
GPG key ID: 215C21B10DF38B4D
3 changed files with 58 additions and 2 deletions

View file

@ -1,7 +1,7 @@
{
"name": "nginx-ui-app-next",
"type": "module",
"version": "2.0.0-rc.2",
"version": "2.0.0-rc.3",
"packageManager": "pnpm@10.4.1+sha512.c753b6c3ad7afa13af388fa6d808035a008e30ea9993f58c6663e2bc5ff21679aa834db094987129aa4d488b86df57f7b634981b2f827cdcacc698cc0cfb88af",
"scripts": {
"dev": "vite --host",

View file

@ -1 +1 @@
{"version":"2.0.0-rc.2","build_id":2,"total_build":384}
{"version":"2.0.0-rc.3","build_id":1,"total_build":385}

56
version.sh Executable file
View file

@ -0,0 +1,56 @@
#!/bin/bash
# Version validation regex pattern
VALID_VERSION_REGEX='^v?[0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9\.]+)?$'
# Prompt for version input
while true; do
read -p "Enter version number: " VERSION
# Remove 'v' prefix for validation
if [[ "${VERSION#v}" =~ $VALID_VERSION_REGEX ]]; then
# Show confirmation prompt with original input
echo "You entered version: ${VERSION}"
read -p "Is this correct? [Y/n] " confirm
case ${confirm,,} in
y|yes|"") break ;;
n|no)
echo "Restarting version input..."
continue
;;
*)
echo "Invalid input, please answer Y/n"
continue
;;
esac
else
echo "Error: Invalid version format. Please use semantic versioning (e.g. 2.0.0, v2.0.1-beta.1)"
fi
done
# Cross-platform compatible sed command
if [[ "$OSTYPE" == "darwin"* ]]; then
sed -i '' "s/\"version\": \".*\"/\"version\": \"${VERSION#v}\"/" app/package.json
else
sed -i "s/\"version\": \".*\"/\"version\": \"${VERSION#v}\"/" app/package.json
fi
echo "Updated package.json to version ${VERSION#v}"
# Build app
echo "Building app..."
cd app && pnpm build
if [ $? -ne 0 ]; then
echo "Error: Build failed"
exit 1
fi
cd ..
# Run go generate
echo "Generating Go code..."
go generate ./...
if [ $? -ne 0 ]; then
echo "Error: go generate failed"
exit 1
fi
echo "Version update and generation completed successfully"