-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinit-repo.sh
executable file
·106 lines (85 loc) · 2.06 KB
/
init-repo.sh
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
#!/usr/bin/env bash
# Script to initialize git repository and push to GitHub
set -e
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
cd "$SCRIPT_DIR"
# ANSI colors
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[0;33m'
BLUE='\033[0;34m'
BOLD='\033[1m'
NC='\033[0m' # No Color
echo -e "${BLUE}${BOLD}Initializing Git repository for cac-builder...${NC}"
# Initialize the git repository if not already initialized
if [ ! -d .git ]; then
git init
echo -e "${GREEN}Git repository initialized.${NC}"
else
echo -e "${YELLOW}Git repository already initialized.${NC}"
fi
# Create .gitignore file
cat >.gitignore <<'EOF'
# Certificates
certs/org/*.pem
!certs/org/.gitkeep
# Build artifacts
output/*
!output/.gitkeep
# Environment files
.env
# Docker related
.docker/
# Temporary files
*.tmp
*.bak
*.swp
*~
# macOS specific files
.DS_Store
.AppleDouble
.LSOverride
# Windows specific files
Thumbs.db
ehthumbs.db
Desktop.ini
# IDE files
.idea/
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
.history
*.code-workspace
# Python
__pycache__/
*.py[cod]
*$py.class
.pytest_cache/
EOF
# Create empty directories with .gitkeep
mkdir -p certs/org
touch certs/org/.gitkeep
mkdir -p output
touch output/.gitkeep
# Add all files
git add .
# Create initial commit
git commit -m "Initial commit
This commit includes:
- Docker configuration for ComplianceAsCode builder
- Documentation for setup and usage
- Scripts for certificate and environment management
- GitHub Actions workflows for building and testing
- Project structure and organization"
# Add GitHub remote
echo -e "${BLUE}${BOLD}Adding GitHub remote...${NC}"
git remote add origin https://github.com/mitre/cac-builder.git
echo
echo -e "${GREEN}${BOLD}Repository initialized and committed!${NC}"
echo
echo -e "${YELLOW}Next steps:${NC}"
echo -e "1. Review the commit with ${BOLD}git show${NC}"
echo -e "2. Push to GitHub with ${BOLD}git push -u origin main${NC}"
echo -e "3. Once pushed, test GitHub Actions workflows with ${BOLD}./scripts/test-github-actions.sh --list${NC}"