Merge pull request #13 from Wambaborel/ci_cd #13
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI/CD Workflow | |
on: | |
push: | |
branches: | |
- main # Changed to "main" 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' | |
# Step 3: Install dependencies for each project in the root directory | |
- name: Install dependencies for each project | |
run: | | |
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" | |
pip install -r "$dir/requirements.txt" | |
else | |
echo "No requirements.txt found in $dir" | |
fi | |
done | |
# Step 4: Generate README files for each project | |
- name: Generate README files | |
run: | | |
for dir in */; do | |
# Skip non-project folders | |
if [[ "$dir" == ".github/" ]]; then | |
continue | |
fi | |
project_name=$(basename "$dir") | |
readme_file="$dir/README.md" | |
# Create a README file with documentation | |
cat <<EOL > "$readme_file" | |
# $project_name | |
## Description | |
This is the README for the $project_name project. | |
## Installation | |
To install the dependencies, run the following command: | |
\`\`\`bash | |
pip install -r requirements.txt | |
\`\`\` | |
## Usage | |
Instructions for using the $project_name project go here. | |
--- | |
*📄 This README was automatically generated by the CI/CD workflow. 🤖* | |
EOL | |
echo "Generated README for $project_name" | |
done |