BMAD-METHOD/.github/workflows/bundle-latest.yaml
Murat K Ozcan 449b5b3d29
chore: github pages for web bundle (#898)
* chore: github pages for web bundle

* docs: updated Bundle distribution setup

* chore: addressed PR comments

---------

Co-authored-by: Murat Ozcan <murat@mac.lan>
2025-11-11 13:35:30 -06:00

223 lines
8.6 KiB
YAML

name: Publish Latest Bundles
on:
push:
branches: [main]
workflow_dispatch: {}
permissions:
contents: write
jobs:
bundle-and-publish:
runs-on: ubuntu-latest
steps:
- name: Checkout BMAD-METHOD
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"
cache: npm
- name: Install dependencies
run: npm ci
- name: Generate bundles
run: npm run bundle
- name: Create bundle distribution structure
run: |
mkdir -p dist/bundles
# Copy bundles with clean structure
cp -r src/modules/bmm/sub-modules/* dist/bundles/ 2>/dev/null || true
cp -r src/modules/bmb/sub-modules/* dist/bundles/ 2>/dev/null || true
cp -r src/modules/cis/sub-modules/* dist/bundles/ 2>/dev/null || true
# Verify bundles were copied (fail if completely empty)
if [ ! "$(ls -A dist/bundles)" ]; then
echo "❌ ERROR: No bundles found in dist/bundles/"
echo "This likely means 'npm run bundle' failed or bundles weren't generated"
exit 1
fi
# Count bundles per platform
for platform in claude-code chatgpt gemini; do
if [ -d "dist/bundles/$platform" ]; then
COUNT=$(find dist/bundles/$platform -name '*.md' 2>/dev/null | wc -l)
echo "✅ $platform: $COUNT bundles"
fi
done
# Create index.html for GitHub Pages
cat > dist/bundles/index.html << 'EOF'
<!DOCTYPE html>
<html>
<head>
<title>BMAD Bundles - Latest</title>
<meta charset="utf-8">
<style>
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; max-width: 800px; margin: 50px auto; padding: 20px; }
h1 { color: #333; }
.platform { margin: 30px 0; padding: 20px; background: #f5f5f5; border-radius: 8px; }
.module { margin: 15px 0; }
a { color: #0066cc; text-decoration: none; }
a:hover { text-decoration: underline; }
code { background: #e0e0e0; padding: 2px 6px; border-radius: 3px; }
.warning { background: #fff3cd; padding: 15px; border-left: 4px solid #ffc107; margin: 20px 0; }
</style>
</head>
<body>
<h1>BMAD Web Bundles - Latest (Main Branch)</h1>
<div class="warning">
<strong>⚠️ Latest Build (Unstable)</strong><br>
These bundles are built from the latest main branch commit. For stable releases, visit
<a href="https://github.com/bmad-code-org/BMAD-METHOD/releases/latest">GitHub Releases</a>.
</div>
<p><strong>Last Updated:</strong> <code>$TIMESTAMP</code></p>
<p><strong>Commit:</strong> <code>$COMMIT_SHA</code></p>
<h2>Available Platforms</h2>
<div class="platform">
<h3>Claude Code</h3>
<div class="module">
<strong>BMM (BMad Method)</strong><br>
<a href="./claude-code/sub-agents/bmm-agent-pm.md">PM Agent</a> |
<a href="./claude-code/sub-agents/bmm-agent-architect.md">Architect</a> |
<a href="./claude-code/sub-agents/bmm-agent-tea.md">TEA</a> |
<a href="./claude-code/sub-agents/bmm-agent-dev.md">Developer</a> |
<a href="./claude-code/sub-agents/">All BMM Agents</a>
</div>
<div class="module">
<strong>BMB (BMad Builder)</strong><br>
<a href="./claude-code/sub-agents/bmb-agent-builder.md">Builder Agent</a>
</div>
<div class="module">
<strong>CIS (Creative Intelligence Suite)</strong><br>
<a href="./claude-code/sub-agents/">CIS Agents</a>
</div>
</div>
<div class="platform">
<h3>ChatGPT</h3>
<div class="module">
<strong>BMM</strong>: <a href="./chatgpt/sub-agents/">Browse BMM Agents</a><br>
<strong>BMB</strong>: <a href="./chatgpt/sub-agents/">Browse BMB Agents</a><br>
<strong>CIS</strong>: <a href="./chatgpt/sub-agents/">Browse CIS Agents</a>
</div>
</div>
<div class="platform">
<h3>Gemini</h3>
<div class="module">
<strong>BMM</strong>: <a href="./gemini/sub-agents/">Browse BMM Agents</a><br>
<strong>BMB</strong>: <a href="./gemini/sub-agents/">Browse BMB Agents</a><br>
<strong>CIS</strong>: <a href="./gemini/sub-agents/">Browse CIS Agents</a>
</div>
</div>
<h2>Usage</h2>
<p>Copy the raw markdown URL and paste into your AI platform's custom instructions or project knowledge.</p>
<p>Example: <code>https://raw.githubusercontent.com/bmad-code-org/bmad-bundles/main/claude-code/sub-agents/bmm-agent-pm.md</code></p>
<h2>Installation (Recommended)</h2>
<p>For full IDE integration with slash commands, use the installer:</p>
<pre>npx bmad-method@alpha install</pre>
<footer style="margin-top: 50px; padding-top: 20px; border-top: 1px solid #ccc; color: #666;">
<p>Built from <a href="https://github.com/bmad-code-org/BMAD-METHOD">BMAD-METHOD</a> repository.</p>
</footer>
</body>
</html>
EOF
# Replace placeholders
TIMESTAMP=$(date -u +"%Y-%m-%d %H:%M UTC")
COMMIT_SHA=$(git rev-parse --short HEAD)
sed -i "s/\$TIMESTAMP/$TIMESTAMP/" dist/bundles/index.html
sed -i "s/\$COMMIT_SHA/$COMMIT_SHA/" dist/bundles/index.html
- name: Checkout bmad-bundles repo
uses: actions/checkout@v4
with:
repository: bmad-code-org/bmad-bundles
path: bmad-bundles
token: ${{ secrets.BUNDLES_PAT }}
- name: Update bundles
run: |
# Clear old bundles
rm -rf bmad-bundles/*
# Copy new bundles
cp -r dist/bundles/* bmad-bundles/
# Create .nojekyll for GitHub Pages
touch bmad-bundles/.nojekyll
# Create README
cat > bmad-bundles/README.md << 'EOF'
# BMAD Web Bundles (Latest)
**⚠️ Unstable Build**: These bundles are auto-generated from the latest `main` branch.
For stable releases, visit [GitHub Releases](https://github.com/bmad-code-org/BMAD-METHOD/releases/latest).
## Usage
Copy raw markdown URLs for use in AI platforms:
- Claude Code: `https://raw.githubusercontent.com/bmad-code-org/bmad-bundles/main/claude-code/sub-agents/{agent}.md`
- ChatGPT: `https://raw.githubusercontent.com/bmad-code-org/bmad-bundles/main/chatgpt/sub-agents/{agent}.md`
- Gemini: `https://raw.githubusercontent.com/bmad-code-org/bmad-bundles/main/gemini/sub-agents/{agent}.md`
## Browse
Visit [https://bmad-code-org.github.io/bmad-bundles/](https://bmad-code-org.github.io/bmad-bundles/) to browse bundles.
## Installation (Recommended)
For full IDE integration:
```bash
npx bmad-method@alpha install
```
---
Auto-updated by [BMAD-METHOD](https://github.com/bmad-code-org/BMAD-METHOD) on every main branch merge.
EOF
- name: Commit and push to bmad-bundles
run: |
cd bmad-bundles
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add .
if git diff --staged --quiet; then
echo "No changes to bundles, skipping commit"
else
COMMIT_SHA=$(cd .. && git rev-parse --short HEAD)
git commit -m "Update bundles from BMAD-METHOD@${COMMIT_SHA}"
git push
echo "✅ Bundles published to GitHub Pages"
fi
- name: Summary
run: |
echo "## 🎉 Bundles Published!" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "**Latest bundles** available at:" >> $GITHUB_STEP_SUMMARY
echo "- 🌐 Browse: https://bmad-code-org.github.io/bmad-bundles/" >> $GITHUB_STEP_SUMMARY
echo "- 📦 Raw files: https://github.com/bmad-code-org/bmad-bundles" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "**Commit**: ${{ github.sha }}" >> $GITHUB_STEP_SUMMARY