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: Deploy Jekyll with GitHub Pages dependencies preinstalled | ||
| on: | ||
| push: | ||
| branches: ["main"] | ||
| paths-ignore: | ||
| - 'VERSION' | ||
| workflow_dispatch: | ||
| permissions: | ||
| contents: write | ||
| pages: write | ||
| id-token: write | ||
| concurrency: | ||
| group: "pages" | ||
| cancel-in-progress: false | ||
| jobs: | ||
| build: | ||
| runs-on: ubuntu-latest | ||
| outputs: | ||
| version: ${{ steps.version.outputs.VERSION }} | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v4 | ||
| - name: Set version | ||
| id: version | ||
| run: | | ||
| VERSION="1.0.${{ github.run_number }}" | ||
| echo "VERSION=$VERSION" >> $GITHUB_OUTPUT | ||
| echo "$VERSION" > VERSION | ||
| - name: Commit version file | ||
| run: | | ||
| git config user.name "github-actions[bot]" | ||
| git config user.email "github-actions[bot]@users.noreply.github.com" | ||
| git add VERSION | ||
| git diff --staged --quiet || git commit -m "Bump version to ${{ steps.version.outputs.VERSION }} [skip ci]" | ||
| git push | ||
| - name: Add version and build date to config | ||
| run: | | ||
| echo "version: \"${{ steps.version.outputs.VERSION }}\"" >> github-pages/_config.yml | ||
| echo "build_date: \"$(date +'%Y-%m-%d')\"" >> github-pages/_config.yml | ||
| - name: Generate templates page | ||
| run: | | ||
| cat > github-pages/templates.md << 'EOF' | ||
| --- | ||
| layout: default | ||
| title: Templates | ||
| nav_order: 2 | ||
| --- | ||
| # Templates | ||
| Copy these templates to your project and customize them. | ||
| EOF | ||
| sed -i 's/^ //' github-pages/templates.md | ||
| for file in docs/templates/*.md; do | ||
| if [ -f "$file" ]; then | ||
| filename=$(basename "$file") | ||
| name="${filename%.md}" | ||
| # Read first line as title (remove # prefix) | ||
| title=$(head -1 "$file" | sed 's/^#* *//') | ||
| # Read second non-empty line as description | ||
| desc=$(sed -n '2,10p' "$file" | grep -v '^$' | grep -v '^#' | head -1) | ||
| cat >> github-pages/templates.md << TEMPLATE | ||
| --- | ||
| ## ${title:-$name} | ||
| ${desc:-Template file for your project.} | ||
| [View on GitHub](https://github.com/managedcode/MCAF/blob/main/docs/templates/${filename}){: .btn .btn-primary } | ||
| [Download](https://raw.githubusercontent.com/managedcode/MCAF/main/docs/templates/${filename}){: .btn } | ||
| TEMPLATE | ||
| fi | ||
| done | ||
| - name: Copy README to github-pages with TOC | ||
| run: | | ||
| # Front matter | ||
| printf '%s\n' '---' 'layout: default' 'title: MCAF Guide' 'nav_order: 1' '---' '' > github-pages/index.md | ||
| # Header (before first ---) | ||
| awk '/^---$/{exit} {print}' README.md >> github-pages/index.md | ||
| # TOC | ||
| cat >> github-pages/index.md << 'TOCEOF' | ||
| <nav class="toc"> | ||
| <div class="toc-title">Table of Contents</div> | ||
| <ol> | ||
| <li><a href="#1-what-mcaf-is">What MCAF Is</a></li> | ||
| <li><a href="#2-context">Context</a></li> | ||
| <li><a href="#3-verification">Verification</a></li> | ||
| <li><a href="#4-instructions-and-agentsmd">Instructions and AGENTS.md</a></li> | ||
| <li><a href="#5-coding-and-testability">Coding and Testability</a></li> | ||
| <li><a href="#6-perspectives">Perspectives</a></li> | ||
| <li><a href="#7-development-cycle">Development Cycle</a></li> | ||
| <li><a href="#8-ai-participation-modes">AI Participation Modes</a></li> | ||
| <li><a href="#9-adopting-mcaf-in-a-repository">Adopting MCAF</a></li> | ||
| </ol> | ||
| </nav> | ||
| --- | ||
| TOCEOF | ||
| # Content (after first ---) | ||
| awk '/^---$/{found=1; next} found{print}' README.md >> github-pages/index.md | ||
| - name: Setup Pages | ||
| uses: actions/configure-pages@v5 | ||
| - name: Build with Jekyll | ||
| uses: actions/jekyll-build-pages@v1 | ||
| with: | ||
| source: ./github-pages | ||
| destination: ./_site | ||
| - name: Upload artifact | ||
| uses: actions/upload-pages-artifact@v3 | ||
| deploy: | ||
| runs-on: ubuntu-latest | ||
| needs: build | ||
| steps: | ||
| - name: Deploy to GitHub Pages | ||
| id: deployment | ||
| uses: actions/deploy-pages@v4 | ||
| release: | ||
| runs-on: ubuntu-latest | ||
| needs: build | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v4 | ||
| - name: Create Release | ||
| uses: softprops/action-gh-release@v1 | ||
| with: | ||
| tag_name: v${{ needs.build.outputs.version }} | ||
| name: Release ${{ needs.build.outputs.version }} | ||
| body: | | ||
| ## MCAF Release ${{ needs.build.outputs.version }} | ||
| Managed Code Coding AI Framework | ||
| draft: false | ||
| prerelease: false | ||
| generate_release_notes: true | ||