fix(infra): Correct skills docs path in GH workflow #5
This file contains hidden or 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: Main CI/CD Pipeline | |
| on: | |
| pull_request: | |
| branches: [ latest ] | |
| types: [ opened, synchronize, reopened ] | |
| push: | |
| branches: [ latest ] | |
| # Set permissions for GitHub Pages deployment and PR comments | |
| permissions: | |
| contents: read | |
| pages: write | |
| id-token: write | |
| pull-requests: write | |
| deployments: write | |
| # Allow only one concurrent deployment per ref | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| # Publish agent docs to agent-docs branch (main branch only) | |
| publish-agent-docs: | |
| name: Publish Agent Docs Branch | |
| if: github.event_name == 'push' && github.ref == 'refs/heads/latest' | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up Ruby | |
| uses: ruby/setup-ruby@v1 | |
| with: | |
| ruby-version: "3.3" | |
| bundler-cache: true | |
| - name: Generate agent docs | |
| run: bundle exec rake gen_agent_docs | |
| - name: Backup agent docs | |
| run: | | |
| # Save generated docs to a temp location before branch switch | |
| mkdir -p /tmp/agent-docs-backup | |
| cp -r docs/skills/* /tmp/agent-docs-backup/ | |
| echo "✅ Agent docs backed up" | |
| - name: Setup agent-docs branch | |
| run: | | |
| # Check if agent-docs branch exists | |
| if git ls-remote --exit-code --heads origin agent-docs; then | |
| echo "Branch exists, checking out" | |
| git fetch origin agent-docs | |
| git checkout agent-docs | |
| else | |
| echo "Branch doesn't exist, creating orphan branch" | |
| git checkout --orphan agent-docs | |
| git rm -rf . | |
| fi | |
| - name: Copy agent docs | |
| run: | | |
| # Start fresh - remove everything except .git | |
| find . -maxdepth 1 ! -name '.git' ! -name '.' ! -name '..' -exec rm -rf {} + | |
| # Restore agent docs from backup | |
| if [ -d "/tmp/agent-docs-backup" ]; then | |
| cp -r /tmp/agent-docs-backup/* . | |
| echo "✅ Agent docs restored from backup" | |
| else | |
| echo "❌ Agent docs backup not found" | |
| exit 1 | |
| fi | |
| - name: Commit and push | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| git add -A | |
| git commit -m "Update agent docs from ${{ github.sha }}" || echo "No changes to commit" | |
| git push origin agent-docs | |
| - name: Create deployment summary | |
| run: | | |
| echo "## 📚 Agent Docs Published!" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "**Branch:** agent-docs" >> $GITHUB_STEP_SUMMARY | |
| echo "**Source Commit:** ${{ github.sha }}" >> $GITHUB_STEP_SUMMARY | |
| echo "**Published at:** $(date -u +'%Y-%m-%d %H:%M:%S UTC')" >> $GITHUB_STEP_SUMMARY |