-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeploy.sh
More file actions
67 lines (51 loc) · 1.39 KB
/
deploy.sh
File metadata and controls
67 lines (51 loc) · 1.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#!/bin/bash
# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
NC='\033[0m' # No Color
echo -e "${GREEN}Starting deployment process...${NC}"
# Check if repository URL is provided
if [ -z "$1" ]; then
echo -e "${RED}Please provide your repository URL${NC}"
echo "Usage: ./deploy.sh <repository-url>"
exit 1
fi
REPO_URL=$1
# Install dependencies
echo -e "${GREEN}Installing dependencies...${NC}"
pnpm install
# Run tests
echo -e "${GREEN}Running tests...${NC}"
pnpm test -- --watchAll=false
# Run linting
echo -e "${GREEN}Running linting...${NC}"
pnpm lint
# Run format
echo -e "${GREEN}Formatting code...${NC}"
pnpm format
# Build the project
echo -e "${GREEN}Building the project...${NC}"
pnpm build
# Initialize git if not already initialized
if [ ! -d .git ]; then
echo -e "${GREEN}Initializing git repository...${NC}"
git init
fi
# Check if remote origin exists
if ! git remote | grep -q "^origin$"; then
echo -e "${GREEN}Adding remote origin...${NC}"
git remote add origin $REPO_URL
fi
# Stage all files
echo -e "${GREEN}Staging files...${NC}"
git add .
# Commit changes
echo -e "${GREEN}Committing changes...${NC}"
git commit -m "Deploy to GitHub Pages"
# Push to main branch
echo -e "${GREEN}Pushing to main branch...${NC}"
git push -u origin main
# Deploy to GitHub Pages
echo -e "${GREEN}Deploying to GitHub Pages...${NC}"
pnpm deploy
echo -e "${GREEN}Deployment complete!${NC}"