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 web bundles (XML files from npm run bundle output) cp -r web-bundles/* 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 module for module in bmm bmb cis bmgd; do if [ -d "dist/bundles/$module/agents" ]; then COUNT=$(find dist/bundles/$module/agents -name '*.xml' 2>/dev/null | wc -l) echo "✅ $module: $COUNT agent bundles" fi done # Generate index.html for each agents directory (fixes directory browsing) for module in bmm bmb cis bmgd; do if [ -d "dist/bundles/$module/agents" ]; then cat > "dist/bundles/$module/agents/index.html" << 'DIREOF' MODULE_NAME Agents

MODULE_NAME Agents

← Back to all modules

DIREOF # Replace MODULE_NAME sed -i "s/MODULE_NAME/${module^^}/g" "dist/bundles/$module/agents/index.html" # Generate agent links LINKS="" for file in dist/bundles/$module/agents/*.xml; do if [ -f "$file" ]; then name=$(basename "$file" .xml) LINKS="$LINKS
  • $name
  • \n" fi done sed -i "s|AGENT_LINKS|$LINKS|" "dist/bundles/$module/agents/index.html" fi done # Create zip archives per module mkdir -p dist/bundles/downloads for module in bmm bmb cis bmgd; do if [ -d "dist/bundles/$module" ]; then (cd dist/bundles && zip -r downloads/$module-agents.zip $module/) echo "✅ Created $module-agents.zip" fi done # Generate index.html dynamically based on actual bundles TIMESTAMP=$(date -u +"%Y-%m-%d %H:%M UTC") COMMIT_SHA=$(git rev-parse --short HEAD) # Function to generate agent links for a module generate_agent_links() { local module=$1 local agent_dir="dist/bundles/$module/agents" if [ ! -d "$agent_dir" ]; then echo "" return fi local links="" local count=0 # Find all XML files and generate links for xml_file in "$agent_dir"/*.xml; do if [ -f "$xml_file" ]; then local agent_name=$(basename "$xml_file" .xml) # Convert filename to display name (pm -> PM, tech-writer -> Tech Writer) local display_name=$(echo "$agent_name" | sed 's/-/ /g' | awk '{for(i=1;i<=NF;i++) {if(length($i)==2) $i=toupper($i); else $i=toupper(substr($i,1,1)) tolower(substr($i,2));}}1') if [ $count -gt 0 ]; then links="$links | " fi links="$links$display_name" count=$((count + 1)) fi done echo "$links" } # Generate agent links for each module BMM_LINKS=$(generate_agent_links "bmm") CIS_LINKS=$(generate_agent_links "cis") BMGD_LINKS=$(generate_agent_links "bmgd") # Count agents for bulk downloads BMM_COUNT=$(find dist/bundles/bmm/agents -name '*.xml' 2>/dev/null | wc -l | tr -d ' ') CIS_COUNT=$(find dist/bundles/cis/agents -name '*.xml' 2>/dev/null | wc -l | tr -d ' ') BMGD_COUNT=$(find dist/bundles/bmgd/agents -name '*.xml' 2>/dev/null | wc -l | tr -d ' ') # Create index.html cat > dist/bundles/index.html << EOF BMAD Bundles - Latest

    BMAD Web Bundles - Latest (Main Branch)

    ⚠️ Latest Build (Unstable)
    These bundles are built from the latest main branch commit. For stable releases, visit GitHub Releases.

    Last Updated: $TIMESTAMP

    Commit: $COMMIT_SHA

    Available Modules

    EOF # Add BMM section if agents exist if [ -n "$BMM_LINKS" ]; then cat >> dist/bundles/index.html << EOF

    BMM (BMad Method)

    $BMM_LINKS
    📁 Browse All | 📦 Download Zip
    EOF fi # Add CIS section if agents exist if [ -n "$CIS_LINKS" ]; then cat >> dist/bundles/index.html << EOF

    CIS (Creative Intelligence Suite)

    $CIS_LINKS
    📁 Browse Agents | 📦 Download Zip
    EOF fi # Add BMGD section if agents exist if [ -n "$BMGD_LINKS" ]; then cat >> dist/bundles/index.html << EOF

    BMGD (Game Development)

    $BMGD_LINKS
    📁 Browse Agents | 📦 Download Zip
    EOF fi # Add bulk downloads section cat >> dist/bundles/index.html << EOF

    Bulk Downloads

    Download all agents for a module as a zip archive:

    Usage

    Copy the raw XML URL and paste into your AI platform's custom instructions or project knowledge.

    Example: https://raw.githubusercontent.com/bmad-code-org/bmad-bundles/main/bmm/agents/pm.xml

    Installation (Recommended)

    For full IDE integration with slash commands, use the installer:

    npx bmad-method@alpha install
    EOF - 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