feat: add --skip-tests flag to release script
Allows releasing when confident about code changes even with pre-existing flaky tests. Usage: ./scripts/release.sh patch --skip-tests
This commit is contained in:
parent
84760471ac
commit
061417185d
1 changed files with 28 additions and 8 deletions
|
|
@ -13,15 +13,31 @@ NC='\033[0m' # No Color
|
||||||
|
|
||||||
# Parse arguments
|
# Parse arguments
|
||||||
RELEASE_TYPE="${1:-patch}" # patch, minor, or major
|
RELEASE_TYPE="${1:-patch}" # patch, minor, or major
|
||||||
DRY_RUN="${2}"
|
SKIP_TESTS=false
|
||||||
|
DRY_RUN=false
|
||||||
|
|
||||||
|
for arg in "$@"; do
|
||||||
|
case $arg in
|
||||||
|
--skip-tests)
|
||||||
|
SKIP_TESTS=true
|
||||||
|
;;
|
||||||
|
--dry-run)
|
||||||
|
DRY_RUN=true
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
echo -e "${BLUE}🚀 Brainy Release Script${NC}"
|
echo -e "${BLUE}🚀 Brainy Release Script${NC}"
|
||||||
echo -e "${BLUE}Release type: ${RELEASE_TYPE}${NC}\n"
|
echo -e "${BLUE}Release type: ${RELEASE_TYPE}${NC}\n"
|
||||||
|
|
||||||
if [ "$DRY_RUN" == "--dry-run" ]; then
|
if [ "$DRY_RUN" = true ]; then
|
||||||
echo -e "${YELLOW}⚠️ DRY RUN MODE - No changes will be made${NC}\n"
|
echo -e "${YELLOW}⚠️ DRY RUN MODE - No changes will be made${NC}\n"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ "$SKIP_TESTS" = true ]; then
|
||||||
|
echo -e "${YELLOW}⚠️ SKIPPING TESTS - Use with caution!${NC}\n"
|
||||||
|
fi
|
||||||
|
|
||||||
# Step 1: Verify clean git state
|
# Step 1: Verify clean git state
|
||||||
echo -e "${BLUE}1️⃣ Checking git status...${NC}"
|
echo -e "${BLUE}1️⃣ Checking git status...${NC}"
|
||||||
if [ -n "$(git status --porcelain)" ]; then
|
if [ -n "$(git status --porcelain)" ]; then
|
||||||
|
|
@ -32,17 +48,21 @@ echo -e "${GREEN}✅ Working directory clean${NC}\n"
|
||||||
|
|
||||||
# Step 2: Build
|
# Step 2: Build
|
||||||
echo -e "${BLUE}2️⃣ Building project...${NC}"
|
echo -e "${BLUE}2️⃣ Building project...${NC}"
|
||||||
if [ "$DRY_RUN" != "--dry-run" ]; then
|
if [ "$DRY_RUN" = false ]; then
|
||||||
npm run build
|
npm run build
|
||||||
fi
|
fi
|
||||||
echo -e "${GREEN}✅ Build successful${NC}\n"
|
echo -e "${GREEN}✅ Build successful${NC}\n"
|
||||||
|
|
||||||
# Step 3: Test
|
# Step 3: Test
|
||||||
|
if [ "$SKIP_TESTS" = false ]; then
|
||||||
echo -e "${BLUE}3️⃣ Running tests...${NC}"
|
echo -e "${BLUE}3️⃣ Running tests...${NC}"
|
||||||
if [ "$DRY_RUN" != "--dry-run" ]; then
|
if [ "$DRY_RUN" = false ]; then
|
||||||
npm test
|
npm test
|
||||||
fi
|
fi
|
||||||
echo -e "${GREEN}✅ Tests passed${NC}\n"
|
echo -e "${GREEN}✅ Tests passed${NC}\n"
|
||||||
|
else
|
||||||
|
echo -e "${YELLOW}3️⃣ Skipping tests...${NC}\n"
|
||||||
|
fi
|
||||||
|
|
||||||
# Step 4: Get current and new version
|
# Step 4: Get current and new version
|
||||||
CURRENT_VERSION=$(node -p "require('./package.json').version")
|
CURRENT_VERSION=$(node -p "require('./package.json').version")
|
||||||
|
|
@ -73,7 +93,7 @@ esac
|
||||||
|
|
||||||
echo -e "${BLUE}New version: ${NEW_VERSION}${NC}\n"
|
echo -e "${BLUE}New version: ${NEW_VERSION}${NC}\n"
|
||||||
|
|
||||||
if [ "$DRY_RUN" == "--dry-run" ]; then
|
if [ "$DRY_RUN" = true ]; then
|
||||||
echo -e "${YELLOW}DRY RUN: Would release version ${NEW_VERSION}${NC}"
|
echo -e "${YELLOW}DRY RUN: Would release version ${NEW_VERSION}${NC}"
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue