|
1 | | -# Simple workflow for deploying static content to GitHub Pages |
2 | | -name: Deploy static content to Pages |
| 1 | +name: Deploy to GitHub Pages |
| 2 | + |
3 | 3 | on: |
4 | | - # Runs on pushes targeting the default branch |
5 | 4 | push: |
6 | | - branches: ["main"] |
7 | | - # Allows you to run this workflow manually from the Actions tab |
| 5 | + branches: [main] |
| 6 | + repository_dispatch: |
| 7 | + types: [docs-updated] |
8 | 8 | workflow_dispatch: |
9 | | -# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages |
| 9 | + |
10 | 10 | permissions: |
11 | 11 | contents: read |
12 | 12 | pages: write |
13 | 13 | id-token: write |
14 | | -# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. |
15 | | -# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. |
| 14 | + |
16 | 15 | concurrency: |
17 | | - group: "pages" |
| 16 | + group: pages |
18 | 17 | cancel-in-progress: false |
| 18 | + |
19 | 19 | jobs: |
20 | | - # Single deploy job since we're just deploying |
21 | 20 | deploy: |
22 | 21 | environment: |
23 | 22 | name: github-pages |
24 | 23 | url: ${{ steps.deployment.outputs.page_url }} |
25 | 24 | runs-on: ubuntu-latest |
26 | 25 | steps: |
27 | | - - name: Checkout |
| 26 | + - name: Checkout website repo |
28 | 27 | uses: actions/checkout@v4 |
| 28 | + |
| 29 | + # --- Pull docs from plugin repos --- |
| 30 | + - name: Checkout MyTrip docs |
| 31 | + uses: actions/checkout@v4 |
| 32 | + with: |
| 33 | + repository: ChafficPlugins/MyTrip |
| 34 | + path: _repos/mytrip |
| 35 | + sparse-checkout: docs |
| 36 | + |
| 37 | + - name: Checkout MiningLevels docs |
| 38 | + uses: actions/checkout@v4 |
| 39 | + with: |
| 40 | + repository: ChafficPlugins/MiningLevels |
| 41 | + path: _repos/mininglevels |
| 42 | + sparse-checkout: docs |
| 43 | + |
| 44 | + - name: Checkout CrucialLib docs |
| 45 | + uses: actions/checkout@v4 |
| 46 | + with: |
| 47 | + repository: ChafficPlugins/CrucialLib |
| 48 | + path: _repos/cruciallib |
| 49 | + sparse-checkout: docs |
| 50 | + |
| 51 | + - name: Aggregate docs from all repos |
| 52 | + run: | |
| 53 | + for repo in mytrip mininglevels cruciallib; do |
| 54 | + if [ -d "_repos/$repo/docs" ]; then |
| 55 | + mkdir -p "docs/$repo" |
| 56 | + cp -r "_repos/$repo/docs/." "docs/$repo/" |
| 57 | + echo "Copied docs from $repo" |
| 58 | + else |
| 59 | + echo "No docs/ folder found in $repo (skipping)" |
| 60 | + fi |
| 61 | + done |
| 62 | + echo "" |
| 63 | + echo "Final docs structure:" |
| 64 | + find docs -type f -name "*.md" | sort |
| 65 | +
|
| 66 | + # --- Build MkDocs --- |
| 67 | + - name: Setup Python |
| 68 | + uses: actions/setup-python@v5 |
| 69 | + with: |
| 70 | + python-version: 3.x |
| 71 | + |
| 72 | + - name: Cache pip |
| 73 | + uses: actions/cache@v4 |
| 74 | + with: |
| 75 | + key: mkdocs-material-${{ hashFiles('mkdocs.yml') }} |
| 76 | + path: ~/.cache |
| 77 | + restore-keys: mkdocs-material- |
| 78 | + |
| 79 | + - name: Install MkDocs Material |
| 80 | + run: pip install mkdocs-material |
| 81 | + |
| 82 | + - name: Build docs |
| 83 | + run: mkdocs build --strict |
| 84 | + |
| 85 | + # --- Combine landing page + docs into one artifact --- |
| 86 | + - name: Assemble site |
| 87 | + run: | |
| 88 | + mkdir _site |
| 89 | + # Landing page files |
| 90 | + cp index.html _site/ |
| 91 | + cp redirect.html _site/ |
| 92 | + cp -r style _site/ |
| 93 | + cp -r img _site/ |
| 94 | + # MkDocs output → /docs/ |
| 95 | + mv site _site/docs |
| 96 | +
|
29 | 97 | - name: Setup Pages |
30 | 98 | uses: actions/configure-pages@v5 |
| 99 | + |
31 | 100 | - name: Upload artifact |
32 | 101 | uses: actions/upload-pages-artifact@v3 |
33 | 102 | with: |
34 | | - # Upload entire repository |
35 | | - path: '.' |
| 103 | + path: _site |
| 104 | + |
36 | 105 | - name: Deploy to GitHub Pages |
37 | 106 | id: deployment |
38 | 107 | uses: actions/deploy-pages@v4 |
0 commit comments