|
1 | 1 | # ABOUTME: GitHub Actions workflow for deploying mdBook to GitHub Pages |
2 | | -# ABOUTME: Builds the book on every push to main and deploys to Pages |
| 2 | +# ABOUTME: Builds the book with version info from pierre_mcp_server and deploys to Pages |
3 | 3 |
|
4 | 4 | name: Deploy mdBook to GitHub Pages |
5 | 5 |
|
6 | 6 | on: |
7 | 7 | push: |
8 | 8 | branches: ["main"] |
9 | 9 | workflow_dispatch: |
| 10 | + # Rebuild daily to keep "Updated" date fresh if pierre_mcp_server changes |
| 11 | + schedule: |
| 12 | + - cron: '0 6 * * *' # 6 AM UTC daily |
10 | 13 |
|
11 | 14 | permissions: |
12 | 15 | contents: read |
|
21 | 24 | build: |
22 | 25 | runs-on: ubuntu-latest |
23 | 26 | steps: |
24 | | - - name: Checkout |
| 27 | + - name: Checkout tutorial |
25 | 28 | uses: actions/checkout@v4 |
26 | 29 |
|
| 30 | + - name: Checkout pierre_mcp_server for version info |
| 31 | + uses: actions/checkout@v4 |
| 32 | + with: |
| 33 | + repository: Async-IO/pierre_mcp_server |
| 34 | + path: pierre_mcp_server |
| 35 | + fetch-depth: 1 |
| 36 | + |
| 37 | + - name: Extract version information |
| 38 | + id: version |
| 39 | + run: | |
| 40 | + # Extract version from Cargo.toml |
| 41 | + PIERRE_VERSION=$(grep '^version = ' pierre_mcp_server/Cargo.toml | head -1 | sed 's/version = "\(.*\)"/\1/') |
| 42 | +
|
| 43 | + # Get commit info from pierre_mcp_server |
| 44 | + cd pierre_mcp_server |
| 45 | + COMMIT_HASH=$(git rev-parse HEAD) |
| 46 | + COMMIT_SHORT=$(git rev-parse --short HEAD) |
| 47 | + cd .. |
| 48 | +
|
| 49 | + # Build date |
| 50 | + BUILD_DATE=$(date -u +"%Y-%m-%d") |
| 51 | +
|
| 52 | + # Export for later steps |
| 53 | + echo "pierre_version=$PIERRE_VERSION" >> $GITHUB_OUTPUT |
| 54 | + echo "commit_hash=$COMMIT_HASH" >> $GITHUB_OUTPUT |
| 55 | + echo "commit_short=$COMMIT_SHORT" >> $GITHUB_OUTPUT |
| 56 | + echo "build_date=$BUILD_DATE" >> $GITHUB_OUTPUT |
| 57 | +
|
| 58 | + echo "📦 Pierre version: $PIERRE_VERSION" |
| 59 | + echo "🔗 Commit: $COMMIT_SHORT ($COMMIT_HASH)" |
| 60 | + echo "📅 Build date: $BUILD_DATE" |
| 61 | +
|
| 62 | + - name: Generate version.json |
| 63 | + run: | |
| 64 | + cat > version.json << EOF |
| 65 | + { |
| 66 | + "pierre_version": "${{ steps.version.outputs.pierre_version }}", |
| 67 | + "commit_hash": "${{ steps.version.outputs.commit_hash }}", |
| 68 | + "commit_short": "${{ steps.version.outputs.commit_short }}", |
| 69 | + "build_date": "${{ steps.version.outputs.build_date }}", |
| 70 | + "repo_url": "https://github.com/Async-IO/pierre_mcp_server" |
| 71 | + } |
| 72 | + EOF |
| 73 | + echo "Generated version.json:" |
| 74 | + cat version.json |
| 75 | +
|
27 | 76 | - name: Setup mdBook |
28 | 77 | uses: peaceiris/actions-mdbook@v2 |
29 | 78 | with: |
|
32 | 81 | - name: Build the book |
33 | 82 | run: mdbook build |
34 | 83 |
|
| 84 | + - name: Copy version.json to build output |
| 85 | + run: cp version.json book/version.json |
| 86 | + |
35 | 87 | - name: Setup Pages |
36 | 88 | uses: actions/configure-pages@v5 |
37 | 89 |
|
|
0 commit comments