chore: remove cached
This commit is contained in:
@@ -1,80 +0,0 @@
|
||||
#!/bin/bash
|
||||
# Bump Beta Version Script
|
||||
# Automates version bumping for Beta releases.
|
||||
# Logic:
|
||||
# - If current is Alpha (0.1.0-alpha), bumps to 0.2.0-beta.1
|
||||
# - If current is Beta (0.2.0-beta.X), bumps to 0.2.0-beta.(X+1)
|
||||
# - Updates .version, backend/internal/version/version.go, package.json (root/frontend/backend), VERSION.md
|
||||
|
||||
set -e
|
||||
|
||||
# Colors
|
||||
GREEN='\033[0;32m'
|
||||
YELLOW='\033[1;33m'
|
||||
NC='\033[0m'
|
||||
|
||||
echo -e "${YELLOW}Starting Beta Version Bump...${NC}"
|
||||
|
||||
# 1. Read current version
|
||||
CURRENT_VERSION=$(cat .version 2>/dev/null || echo "0.0.0")
|
||||
echo "Current Version: $CURRENT_VERSION"
|
||||
|
||||
# 2. Calculate new version
|
||||
if [[ "$CURRENT_VERSION" == *"alpha"* ]]; then
|
||||
# Transition from Alpha to Beta
|
||||
NEW_VERSION="0.2.0-beta.1"
|
||||
elif [[ "$CURRENT_VERSION" =~ 0\.2\.0-beta\.([0-9]+) ]]; then
|
||||
# Increment Beta version
|
||||
BETA_NUM="${BASH_REMATCH[1]}"
|
||||
NEXT_NUM=$((BETA_NUM + 1))
|
||||
NEW_VERSION="0.2.0-beta.$NEXT_NUM"
|
||||
else
|
||||
# Fallback / Safety
|
||||
echo "Current version format not recognized for auto-beta bump. Defaulting to 0.2.0-beta.1"
|
||||
NEW_VERSION="0.2.0-beta.1"
|
||||
fi
|
||||
|
||||
echo -e "${GREEN}New Version: $NEW_VERSION${NC}"
|
||||
|
||||
# 3. Update Files
|
||||
|
||||
# .version
|
||||
echo "$NEW_VERSION" > .version
|
||||
echo "Updated .version"
|
||||
|
||||
# backend/internal/version/version.go
|
||||
# Regex to replace: Version = "..."
|
||||
sed -i "s/Version = \".*\"/Version = \"$NEW_VERSION\"/" backend/internal/version/version.go
|
||||
echo "Updated backend/internal/version/version.go"
|
||||
|
||||
# package.json (Frontend)
|
||||
# Using sed for simplicity, assuming standard formatting
|
||||
sed -i "s/\"version\": \".*\"/\"version\": \"$NEW_VERSION\"/" frontend/package.json
|
||||
echo "Updated frontend/package.json"
|
||||
|
||||
# package.json (Backend)
|
||||
sed -i "s/\"version\": \".*\"/\"version\": \"$NEW_VERSION\"/" backend/package.json
|
||||
echo "Updated backend/package.json"
|
||||
|
||||
# VERSION.md (Optional: just appending a log or ensuring it's mentioned?
|
||||
# For now, let's just leave it or maybe update a "Current Version" line if it existed.
|
||||
# The user plan said "Update VERSION.md to reflect the current version".
|
||||
# Let's assume we just want to ensure the file exists or maybe add a header.
|
||||
# Actually, let's just print a reminder for now as VERSION.md is usually a guide.)
|
||||
# But I can replace a specific line if I knew the format.
|
||||
# Looking at previous read_file of VERSION.md, it doesn't seem to have a "Current Version: X" line easily replaceable.
|
||||
# I will skip modifying VERSION.md content automatically to avoid messing up the guide text,
|
||||
# unless I see a specific placeholder.
|
||||
|
||||
# 4. Git Commit and Tag
|
||||
read -p "Do you want to commit and tag this version? (y/n) " -n 1 -r
|
||||
echo
|
||||
if [[ $REPLY =~ ^[Yy]$ ]]; then
|
||||
git add .version backend/internal/version/version.go frontend/package.json backend/package.json
|
||||
git commit -m "chore: bump version to $NEW_VERSION"
|
||||
git tag "v$NEW_VERSION"
|
||||
echo -e "${GREEN}Committed and tagged v$NEW_VERSION${NC}"
|
||||
echo "Remember to push: git push origin feature/beta-release --tags"
|
||||
else
|
||||
echo "Changes made but not committed."
|
||||
fi
|
||||
@@ -1,37 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
FRONTEND_DIR="$ROOT_DIR/frontend"
|
||||
MIN_COVERAGE="${CPM_MIN_COVERAGE:-80}"
|
||||
|
||||
cd "$FRONTEND_DIR"
|
||||
|
||||
# Run tests with coverage and json-summary reporter
|
||||
# We use --passWithNoTests just in case, though we have tests.
|
||||
npm run test:coverage -- --run --coverage.reporter=text --coverage.reporter=json-summary
|
||||
|
||||
SUMMARY_FILE="coverage/coverage-summary.json"
|
||||
|
||||
if [ ! -f "$SUMMARY_FILE" ]; then
|
||||
echo "Error: Coverage summary file not found at $SUMMARY_FILE"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Extract total statements percentage using python
|
||||
TOTAL_PERCENT=$(python3 -c "import json; print(json.load(open('$SUMMARY_FILE'))['total']['statements']['pct'])")
|
||||
|
||||
echo "Computed frontend coverage: ${TOTAL_PERCENT}% (minimum required ${MIN_COVERAGE}%)"
|
||||
|
||||
python3 - <<PY
|
||||
import os, sys
|
||||
from decimal import Decimal
|
||||
|
||||
total = Decimal('$TOTAL_PERCENT')
|
||||
minimum = Decimal('$MIN_COVERAGE')
|
||||
if total < minimum:
|
||||
print(f"Frontend coverage {total}% is below required {minimum}% (set CPM_MIN_COVERAGE to override)", file=sys.stderr)
|
||||
sys.exit(1)
|
||||
PY
|
||||
|
||||
echo "Frontend coverage requirement met"
|
||||
@@ -1,35 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
BACKEND_DIR="$ROOT_DIR/backend"
|
||||
COVERAGE_FILE="$BACKEND_DIR/coverage.txt"
|
||||
MIN_COVERAGE="${CPM_MIN_COVERAGE:-80}"
|
||||
|
||||
# trap 'rm -f "$COVERAGE_FILE"' EXIT
|
||||
|
||||
cd "$BACKEND_DIR"
|
||||
|
||||
go test -mod=readonly -coverprofile="$COVERAGE_FILE" ./internal/...
|
||||
|
||||
go tool cover -func="$COVERAGE_FILE" | tail -n 1
|
||||
TOTAL_LINE=$(go tool cover -func="$COVERAGE_FILE" | grep total)
|
||||
TOTAL_PERCENT=$(echo "$TOTAL_LINE" | awk '{print substr($3, 1, length($3)-1)}')
|
||||
|
||||
echo "Computed coverage: ${TOTAL_PERCENT}% (minimum required ${MIN_COVERAGE}%)"
|
||||
|
||||
export TOTAL_PERCENT
|
||||
export MIN_COVERAGE
|
||||
|
||||
python3 - <<'PY'
|
||||
import os, sys
|
||||
from decimal import Decimal
|
||||
|
||||
total = Decimal(os.environ['TOTAL_PERCENT'])
|
||||
minimum = Decimal(os.environ['MIN_COVERAGE'])
|
||||
if total < minimum:
|
||||
print(f"Coverage {total}% is below required {minimum}% (set CPM_MIN_COVERAGE to override)", file=sys.stderr)
|
||||
sys.exit(1)
|
||||
PY
|
||||
|
||||
echo "Coverage requirement met"
|
||||
@@ -1,104 +0,0 @@
|
||||
#!/bin/bash
|
||||
# Release script for CaddyProxyManager+
|
||||
# Creates a new semantic version release with tag and GitHub release
|
||||
|
||||
set -e
|
||||
|
||||
# Colors for output
|
||||
RED='\033[0;31m'
|
||||
GREEN='\033[0;32m'
|
||||
YELLOW='\033[1;33m'
|
||||
NC='\033[0m' # No Color
|
||||
|
||||
# Functions
|
||||
error() {
|
||||
echo -e "${RED}Error: $1${NC}" >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
success() {
|
||||
echo -e "${GREEN}$1${NC}"
|
||||
}
|
||||
|
||||
warning() {
|
||||
echo -e "${YELLOW}$1${NC}"
|
||||
}
|
||||
|
||||
# Check if we're in a git repository
|
||||
if ! git rev-parse --git-dir > /dev/null 2>&1; then
|
||||
error "Not in a git repository"
|
||||
fi
|
||||
|
||||
# Check for uncommitted changes
|
||||
if [[ -n $(git status -s) ]]; then
|
||||
error "You have uncommitted changes. Please commit or stash them first."
|
||||
fi
|
||||
|
||||
# Check if on correct branch
|
||||
CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD)
|
||||
if [[ "$CURRENT_BRANCH" != "main" && "$CURRENT_BRANCH" != "development" ]]; then
|
||||
warning "You are on branch '$CURRENT_BRANCH'. Releases are typically from 'main' or 'development'."
|
||||
read -p "Continue anyway? (y/N) " -n 1 -r
|
||||
echo
|
||||
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
|
||||
# Get current version from .version file
|
||||
CURRENT_VERSION=$(cat .version 2>/dev/null || echo "0.0.0")
|
||||
echo "Current version: $CURRENT_VERSION"
|
||||
|
||||
# Prompt for new version
|
||||
echo ""
|
||||
echo "Enter new version (e.g., 1.0.0, 1.0.0-beta.1, 1.0.0-rc.1):"
|
||||
read -r NEW_VERSION
|
||||
|
||||
# Validate semantic version format
|
||||
if ! [[ "$NEW_VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9.]+)?$ ]]; then
|
||||
error "Invalid semantic version format. Expected: MAJOR.MINOR.PATCH[-PRERELEASE]"
|
||||
fi
|
||||
|
||||
# Check if tag already exists
|
||||
if git rev-parse "v$NEW_VERSION" >/dev/null 2>&1; then
|
||||
error "Tag v$NEW_VERSION already exists"
|
||||
fi
|
||||
|
||||
# Update .version file
|
||||
echo "$NEW_VERSION" > .version
|
||||
success "Updated .version to $NEW_VERSION"
|
||||
|
||||
# Commit version bump
|
||||
git add .version
|
||||
git commit -m "chore: bump version to $NEW_VERSION"
|
||||
success "Committed version bump"
|
||||
|
||||
# Create annotated tag
|
||||
git tag -a "v$NEW_VERSION" -m "Release v$NEW_VERSION"
|
||||
success "Created tag v$NEW_VERSION"
|
||||
|
||||
# Show what will be pushed
|
||||
echo ""
|
||||
echo "Ready to push:"
|
||||
echo " - Commit: $(git rev-parse HEAD)"
|
||||
echo " - Tag: v$NEW_VERSION"
|
||||
echo " - Branch: $CURRENT_BRANCH"
|
||||
echo ""
|
||||
|
||||
# Confirm push
|
||||
read -p "Push to remote? (y/N) " -n 1 -r
|
||||
echo
|
||||
if [[ $REPLY =~ ^[Yy]$ ]]; then
|
||||
git push origin "$CURRENT_BRANCH"
|
||||
git push origin "v$NEW_VERSION"
|
||||
success "Pushed to remote!"
|
||||
echo ""
|
||||
success "Release workflow triggered!"
|
||||
echo " - GitHub will create a release with changelog"
|
||||
echo " - Docker images will be built and published"
|
||||
echo " - View progress at: https://github.com/Wikid82/CaddyProxyManagerPlus/actions"
|
||||
else
|
||||
warning "Not pushed. You can push later with:"
|
||||
echo " git push origin $CURRENT_BRANCH"
|
||||
echo " git push origin v$NEW_VERSION"
|
||||
fi
|
||||
Reference in New Issue
Block a user