Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Wambaforestin committed Nov 29, 2024
2 parents 70edeca + 7d9e9b6 commit 7f5972d
Showing 1 changed file with 46 additions and 35 deletions.
81 changes: 46 additions & 35 deletions .github/workflows/ci_cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,59 +3,70 @@ name: CI/CD Workflow
on:
push:
branches:
- master
- main # Ensure this matches your default branch

jobs:
build:
runs-on: ubuntu-latest

steps:
# Step 1: Checkout the repository
- name: Checkout repository
uses: actions/checkout@v3

# Step 2: Set up Python
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.12.7' # Set your desired Python version
python-version: '3.12.7'

- name: Install dependencies for each subproject
# Step 3: Install dependencies for each project in the root directory
- name: Install dependencies for each project
run: |
# Loop through each subproject directory
for dir in projects/*; do
if [ -d "$dir" ]; then
for dir in */; do
# Skip non-project folders
if [[ "$dir" == ".github/" ]]; then
continue
fi
echo "Processing $dir"
if [ -f "$dir/requirements.txt" ]; then
echo "Installing dependencies for $dir"
# Check if requirements.txt exists in the subproject
if [ -f "$dir/requirements.txt" ]; then
pip install -r "$dir/requirements.txt"
else
echo "No requirements.txt found in $dir"
fi
pip install -r "$dir/requirements.txt"
else
echo "No requirements.txt found in $dir"
fi
done
- name: Run README Generation
# Step 4: Generate README files for each project
- name: Generate README files
run: |
# Loop through each subproject directory to generate README files
for dir in projects/*; do
if [ -d "$dir" ]; then
project_name=$(basename "$dir")
readme_file="$dir/README.md"
# Create a README file with documentation
echo "# $project_name" > "$readme_file"
echo "" >> "$readme_file"
echo "## Description" >> "$readme_file"
echo "This is the README for the $project_name project." >> "$readme_file"
echo "" >> "$readme_file"
echo "## Installation" >> "$readme_file"
echo "To install the dependencies, run the following command:" >> "$readme_file"
echo "\`\`\`bash" >> "$readme_file"
echo "pip install -r requirements.txt" >> "$readme_file"
echo "\`\`\`" >> "$readme_file"
echo "" >> "$readme_file"
echo "## Usage" >> "$readme_file"
echo "Instructions for using the $project_name project go here." >> "$readme_file"
echo "Generated README for $project_name"
for dir in */; do
# Skip non-project folders
if [[ "$dir" == ".github/" ]]; then
continue
fi
project_name=$(basename "$dir")
readme_file="${dir%/}/README.md" # Remove trailing slash to ensure proper path
# Create a README file with documentation
echo "# $project_name" > "$readme_file"
echo "" >> "$readme_file"
echo "## Description" >> "$readme_file"
echo "This is the README for the $project_name project." >> "$readme_file"
echo "" >> "$readme_file"
echo "## Installation" >> "$readme_file"
echo "To install the dependencies, run the following command:" >> "$readme_file"
echo "```bash" >> "$readme_file"
echo "pip install -r requirements.txt" >> "$readme_file"
echo "```" >> "$readme_file"
echo "" >> "$readme_file"
echo "## Usage" >> "$readme_file"
echo "Instructions for using the $project_name project go here." >> "$readme_file"
echo "" >> "$readme_file"
echo "---" >> "$readme_file"
echo "*📄 This README was automatically generated by the CI/CD workflow. 🤖*" >> "$readme_file"
echo "Generated README for $project_name"
done

0 comments on commit 7f5972d

Please sign in to comment.