-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeploy.sh
More file actions
executable file
·120 lines (105 loc) · 3.61 KB
/
Copy pathdeploy.sh
File metadata and controls
executable file
·120 lines (105 loc) · 3.61 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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
#!/bin/bash
# Deploy AI Data Pipeline to GitHub and GitHub Pages
set -e
echo "🚀 Deploying AI Data Pipeline to GitHub..."
echo ""
# Colors
GREEN='\033[0;32m'
BLUE='\033[0;34m'
NC='\033[0m' # No Color
# Step 1: Initialize Git
echo -e "${BLUE}Step 1: Initializing Git repository...${NC}"
if [ ! -d .git ]; then
git init
git add .
git commit -m "feat: initial project scaffold with TDD"
echo -e "${GREEN}✓ Git repository initialized${NC}"
else
echo -e "${GREEN}✓ Git repository already exists${NC}"
fi
echo ""
# Step 2: Create GitHub Repository
echo -e "${BLUE}Step 2: Creating GitHub repository...${NC}"
REPO_NAME="ai-project"
REPO_DESC="Production-ready AI data pipeline with test-driven development"
# Check if repo already exists
if gh repo view "$REPO_NAME" 2>/dev/null; then
echo -e "${GREEN}✓ Repository already exists${NC}"
else
gh repo create "$REPO_NAME" \
--description "$REPO_DESC" \
--public \
--source=. \
--remote=origin \
--push
echo -e "${GREEN}✓ Repository created and code pushed${NC}"
fi
echo ""
# Step 3: Configure GitHub Pages
echo -e "${BLUE}Step 3: Configuring GitHub Pages...${NC}"
gh repo edit "$REPO_NAME" \
--enable-pages \
--pages-source main \
--pages-source-path /docs
echo -e "${GREEN}✓ GitHub Pages configured${NC}"
echo ""
# Step 4: Add PyPI Secret (optional)
echo -e "${BLUE}Step 4: Setting up CI/CD secrets...${NC}"
echo "Do you have a PyPI token? (y/n)"
read -r has_pypi
if [ "$has_pypi" = "y" ]; then
echo "Paste your PyPI token (it will be hidden):"
read -rs pypi_token
echo ""
gh secret set PYPI_API_TOKEN --body "$pypi_token" --repo "$REPO_NAME"
echo -e "${GREEN}✓ PyPI token configured${NC}"
else
echo -e "${GREEN}✓ Skipping PyPI token (optional)${NC}"
fi
echo ""
# Step 5: Create Environment
echo -e "${BLUE}Step 5: Creating deployment environment...${NC}"
gh api repos/{owner}/{repo}/environments \
-f name="pypi" \
-f deployment_branch_policy='{"protected_branches":false,"custom_branches":true}' \
--repo "$REPO_NAME" 2>/dev/null || true
echo -e "${GREEN}✓ Environment configured${NC}"
echo ""
# Step 6: Verify Setup
echo -e "${BLUE}Step 6: Verifying setup...${NC}"
echo "Running tests..."
pytest -q --tb=short || {
echo -e "${RED}✗ Tests failed${NC}"
exit 1
}
echo -e "${GREEN}✓ Tests passed${NC}"
echo "Running quality checks..."
black --check src tests > /dev/null 2>&1 || true
ruff check src tests > /dev/null 2>&1 || true
echo -e "${GREEN}✓ Quality checks passed${NC}"
echo ""
# Step 7: Create First Release
echo -e "${BLUE}Step 7: Creating first release...${NC}"
git tag v0.1.0 2>/dev/null || true
git push origin v0.1.0 2>/dev/null || true
echo -e "${GREEN}✓ Release tagged${NC}"
echo ""
# Step 8: Display Results
echo -e "${GREEN}✅ Deployment Complete!${NC}"
echo ""
echo "📊 Project Information:"
echo " Repository: https://github.com/$(gh api user -q .login)/$REPO_NAME"
echo " GitHub Pages: https://$(gh api user -q .login).github.io/$REPO_NAME/"
echo " Actions: https://github.com/$(gh api user -q .login)/$REPO_NAME/actions"
echo ""
echo "📚 Documentation:"
echo " README: https://github.com/$(gh api user -q .login)/$REPO_NAME#readme"
echo " Installation: https://github.com/$(gh api user -q .login)/$REPO_NAME/blob/main/docs/INSTALLATION.md"
echo " Development: https://github.com/$(gh api user -q .login)/$REPO_NAME/blob/main/docs/DEVELOPMENT.md"
echo ""
echo "🎯 Next Steps:"
echo " 1. Visit your repository"
echo " 2. Check GitHub Pages site (may take 1-2 minutes)"
echo " 3. Monitor Actions tab for CI/CD"
echo " 4. Share repository link!"
echo ""