Skip to content

Scheduled Extension Build #17

Scheduled Extension Build

Scheduled Extension Build #17

name: Scheduled Extension Build
on:
schedule:
# Run every Monday at 9 AM UTC
- cron: '0 9 * * 1'
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: πŸ“₯ Checkout Repository
uses: actions/checkout@v4
- name: 🐍 Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: πŸ“Š Run Meta Analysis
run: |
python3 scripts/meta-analyzer.py
echo "βœ… Meta analysis complete"
- name: πŸ§ͺ Run Tests
run: |
echo "πŸ§ͺ Running automated tests..."
# Test 1: Verify config file exists and is valid JSON
if ! jq empty data/config/utility_apps_config.json 2>/dev/null; then
echo "❌ Config file is invalid JSON"
exit 1
fi
echo "βœ… Config file is valid"
# Test 2: Count apps
APP_COUNT=$(jq '.apps | length' data/config/utility_apps_config.json)
echo "βœ… Found $APP_COUNT apps in config"
# Test 3: Check for duplicate IDs
DUPLICATE_IDS=$(jq -r '.apps[].id' data/config/utility_apps_config.json | sort | uniq -d)
if [ -n "$DUPLICATE_IDS" ]; then
echo "❌ Found duplicate IDs: $DUPLICATE_IDS"
exit 1
fi
echo "βœ… No duplicate IDs found"
# Test 4: Verify critical files exist
CRITICAL_FILES=(
"index.html"
"apps/development/meta-dashboard.html"
"apps/development/meta-presentation.html"
"apps/games/feedShyworm4.html"
)
for file in "${CRITICAL_FILES[@]}"; do
if [ ! -f "$file" ]; then
echo "❌ Critical file missing: $file"
exit 1
fi
done
echo "βœ… All critical files present"
echo "πŸŽ‰ All tests passed!"
- name: πŸ—οΈ Build Extension
run: |
chmod +x scripts/build-chrome-extension.sh
./scripts/build-chrome-extension.sh
- name: πŸ“¦ Create ZIP
run: |
cd chrome-extension-build
zip -r ../local-first-tools-extension.zip .
cd ..
- name: πŸ“ˆ Generate Health Report
id: health
run: |
APP_COUNT=$(jq '.apps | length' data/config/utility_apps_config.json)
TOTAL_SIZE=$(du -sh chrome-extension-build | cut -f1)
META_APPS=$(jq '.metadata.total_apps' data/meta-analysis.json)
cat > health-report.md << EOF
## πŸ“Š Weekly Health Report
**Report Date:** $(date -u +"%Y-%m-%d %H:%M:%S UTC")
**Repository:** ${{ github.repository }}
### πŸ“ˆ Metrics
| Metric | Value |
|--------|-------|
| Apps in Config | $APP_COUNT |
| Apps Analyzed | $META_APPS |
| Build Size | $TOTAL_SIZE |
| Build Status | βœ… Success |
### πŸ§ͺ Test Results
- βœ… Config validation passed
- βœ… No duplicate IDs
- βœ… All critical files present
- βœ… Extension built successfully
### πŸ“Š Category Distribution
$(jq -r '.category_report.distribution | to_entries | map("- **\(.key)**: \(.value) apps") | join("\n")' data/meta-analysis.json)
### πŸ” Top Technologies
$(jq -r '.technology_stats | to_entries | sort_by(-.value) | .[0:5] | map("- **\(.key)**: \(.value) apps") | join("\n")' data/meta-analysis.json)
### πŸ’‘ Recommendations
$(jq -r '.category_report.recommendations[0:3] | map("- **\(.category)**: \(.suggestions[0])") | join("\n")' data/meta-analysis.json)
---
*This report is automatically generated every Monday.*
EOF
cat health-report.md
echo "app_count=$APP_COUNT" >> $GITHUB_OUTPUT
echo "total_size=$TOTAL_SIZE" >> $GITHUB_OUTPUT
- name: πŸ“€ Upload Health Report
uses: actions/upload-artifact@v3
with:
name: weekly-health-report-${{ github.run_number }}
path: health-report.md
retention-days: 90
- name: πŸ’Ύ Update Repository
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
# Add updated meta-analysis
git add data/meta-analysis.json
if ! git diff --staged --quiet; then
git commit -m "chore: weekly meta-analysis update
- Apps: ${{ steps.health.outputs.app_count }}
- Build size: ${{ steps.health.outputs.total_size }}
- All tests passed βœ…
πŸ€– Auto-generated by scheduled workflow"
git push
echo "βœ… Changes committed"
else
echo "ℹ️ No changes to commit"
fi
- name: πŸ“Š Summary
run: |
echo "### πŸ“Š Weekly Health Check Complete!" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "**Apps:** ${{ steps.health.outputs.app_count }}" >> $GITHUB_STEP_SUMMARY
echo "**Size:** ${{ steps.health.outputs.total_size }}" >> $GITHUB_STEP_SUMMARY
echo "**Status:** βœ… All tests passed" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "See [health report artifact](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}) for full details." >> $GITHUB_STEP_SUMMARY
- name: 🚨 Notify on Failure
if: failure()
run: |
echo "### ⚠️ Weekly Build Failed!" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "The scheduled build encountered errors. Please review the logs." >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "**Action Required:** Check the workflow logs and fix any issues." >> $GITHUB_STEP_SUMMARY