|
1 | 1 | name: Deploy Benchmark Site |
2 | 2 |
|
3 | 3 | on: |
4 | | - # Runs on pushes targeting the default branch |
5 | 4 | push: |
6 | 5 | branches: ["main"] |
7 | | - |
8 | | - # Allows you to run this workflow manually from the Actions tab |
9 | 6 | workflow_dispatch: |
10 | 7 |
|
11 | | -# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages |
12 | 8 | permissions: |
13 | 9 | contents: read |
14 | 10 | pages: write |
15 | 11 | id-token: write |
16 | 12 |
|
17 | | -# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. |
18 | 13 | concurrency: |
19 | 14 | group: "pages" |
20 | 15 | cancel-in-progress: false |
21 | 16 |
|
22 | 17 | jobs: |
23 | | - # Build job |
24 | 18 | build: |
25 | 19 | runs-on: ubuntu-latest |
26 | 20 | steps: |
27 | | - # 1. Checkout the main source code (HTML, CSS, JS, etc.) |
28 | | - - name: Checkout Source (Main) |
| 21 | + # 1. Checkout Main Branch |
| 22 | + - name: Checkout Source |
29 | 23 | uses: actions/checkout@v4 |
30 | 24 |
|
31 | | - # 2. Checkout the visual assets from 'vis-base' branch |
32 | | - # We use sparse-checkout to ONLY fetch the 'results' folder. |
33 | | - # This prevents downloading unnecessary history/files from the asset branch. |
34 | | - - name: Checkout Visual Assets (vis-base) |
| 25 | + # 2. Checkout 'results' folder from vis-base |
| 26 | + - name: Checkout Visual Assets |
35 | 27 | uses: actions/checkout@v4 |
36 | 28 | with: |
37 | | - ref: vis-base # The branch with the images |
38 | | - path: temp_vis_assets # Download to a temporary subfolder |
| 29 | + ref: vis-base |
| 30 | + path: temp_vis_assets |
39 | 31 | sparse-checkout: | |
40 | 32 | results |
41 | 33 | sparse-checkout-cone-mode: false |
42 | 34 |
|
43 | | - # 3. Move the assets into the project root |
44 | | - - name: Inject Visual Assets |
| 35 | + # 3. Move Assets & Ensure Gemfile exists |
| 36 | + # We move images into 'docs/results' so they are part of the site source. |
| 37 | + - name: Prepare Site Content |
45 | 38 | run: | |
46 | | - echo "Preparing to merge visual assets..." |
47 | | - |
48 | | - # Remove existing results folder if it exists (empty) in main to avoid conflicts |
49 | | - rm -rf ./results |
50 | | - |
51 | | - # Move the results folder from the temp checkout to the root |
52 | | - mv temp_vis_assets/results ./results |
53 | | - |
54 | | - # Clean up temp folder |
| 39 | + echo "--- Moving Visual Assets ---" |
| 40 | + mkdir -p docs/results |
| 41 | + # Move contents of temp results to docs/results |
| 42 | + # (Using cp -r to be safe with sparse checkout structures, then rm) |
| 43 | + cp -r temp_vis_assets/results/* docs/results/ |
55 | 44 | rm -rf temp_vis_assets |
56 | 45 | |
57 | | - # Verification: Count files to ensure sparse checkout worked |
58 | | - FILE_COUNT=$(find ./results -type f | wc -l) |
59 | | - echo "✅ Verification successful: Found $FILE_COUNT files in ./results" |
| 46 | + echo "--- Verifying Asset Count ---" |
| 47 | + echo "Found $(find docs/results -type f | wc -l) images in docs/results." |
| 48 | +
|
| 49 | + echo "--- Checking for Gemfile ---" |
| 50 | + if [ ! -f docs/Gemfile ]; then |
| 51 | + echo "No Gemfile found in docs/. Creating a default one for GitHub Pages..." |
| 52 | + echo 'source "https://rubygems.org"' > docs/Gemfile |
| 53 | + echo 'gem "github-pages", group: :jekyll_plugins' >> docs/Gemfile |
| 54 | + echo 'gem "webrick", "~> 1.8"' >> docs/Gemfile # Fix for Ruby 3.0+ |
| 55 | + fi |
60 | 56 |
|
61 | | - # 4. Setup Ruby environment |
| 57 | + # 4. Setup Ruby (Runs inside 'docs' folder now) |
62 | 58 | - name: Setup Ruby |
63 | 59 | uses: ruby/setup-ruby@v1 |
64 | 60 | with: |
65 | 61 | ruby-version: '3.1' |
66 | | - bundler-cache: true # runs 'bundle install' and caches installed gems automatically |
67 | | - cache-version: 1 # Increment if you need to force re-download gems |
| 62 | + bundler-cache: true |
| 63 | + working-directory: 'docs' # <--- CRITICAL: Tells bundler where to install |
68 | 64 |
|
69 | 65 | - name: Setup Pages |
70 | 66 | id: pages |
71 | 67 | uses: actions/configure-pages@v5 |
72 | 68 |
|
73 | | - # 5. Build the site |
74 | | - # Added --verbose and --trace for deep debugging info in logs |
| 69 | + # 5. Build (Runs inside 'docs' folder) |
75 | 70 | - name: Build with Jekyll |
| 71 | + working-directory: 'docs' # <--- CRITICAL: Runs build in the correct folder |
76 | 72 | run: bundle exec jekyll build --baseurl "${{ steps.pages.outputs.base_path }}" --verbose --trace |
77 | 73 | env: |
78 | 74 | JEKYLL_ENV: production |
79 | 75 |
|
| 76 | + # 6. Upload (Points to the _site folder generated inside docs) |
80 | 77 | - name: Upload artifact |
81 | 78 | uses: actions/upload-pages-artifact@v3 |
| 79 | + with: |
| 80 | + path: 'docs/_site' # <--- CRITICAL: Points to the build output |
82 | 81 |
|
83 | | - # Deployment job |
84 | 82 | deploy: |
85 | 83 | environment: |
86 | 84 | name: github-pages |
|
0 commit comments