|
24 | 24 | daemon_changed: ${{ steps.files_changed.outputs.daemon_count != '0' }} |
25 | 25 | daemon_needed: ${{ steps.files_changed.outputs.daemon_count != '0' || steps.files_changed.outputs.installer_build != '0' }} |
26 | 26 | web_changed: ${{ steps.files_changed.outputs.web_count != '0' }} |
27 | | - docs_changed: ${{ steps.files_changed.outputs.docs_count != '0' }} |
| 27 | + docs_changed: ${{ steps.files_changed.outputs.docs_count != '0' || steps.files_changed.outputs.daemon_count != '0' }} |
28 | 28 | installer_changed: ${{ steps.files_changed.outputs.installer_count != '0' }} |
29 | 29 | installer_gui_changed: ${{ steps.files_changed.outputs.installer_gui_count != '0' }} |
30 | 30 | rootshell_needed: ${{ steps.files_changed.outputs.rootshell_count != '0' || steps.files_changed.outputs.installer_build != '0' }} |
@@ -84,40 +84,37 @@ jobs: |
84 | 84 | - uses: actions/checkout@v4 |
85 | 85 | with: |
86 | 86 | persist-credentials: false |
| 87 | + - uses: Swatinem/rust-cache@v2 |
87 | 88 | - name: Install mdBook |
88 | 89 | run: | |
89 | 90 | cargo install mdbook --no-default-features --features search --vers "^0.4" --locked |
90 | 91 | - name: Test mdBook |
91 | 92 | run: mdbook test |
92 | 93 |
|
93 | | - mdbook_publish: |
94 | | - name: Publish mdBook to Github Pages |
| 94 | + mdbook_build: |
| 95 | + name: Build mdBook for Github Pages |
95 | 96 | needs: mdbook_test |
96 | 97 | if: ${{ github.ref == 'refs/heads/main' }} |
97 | 98 | permissions: |
98 | | - pages: write |
99 | 99 | contents: write |
100 | | - id-token: write |
101 | 100 | runs-on: ubuntu-latest |
102 | 101 | steps: |
103 | 102 | - uses: actions/checkout@v4 |
104 | 103 | with: |
105 | 104 | persist-credentials: false |
| 105 | + - uses: Swatinem/rust-cache@v2 |
106 | 106 | - name: Install mdBook |
107 | 107 | run: | |
108 | 108 | cargo install mdbook --no-default-features --features search --vers "^0.4" --locked |
109 | 109 |
|
110 | 110 | - name: Build mdBook |
111 | 111 | run: mdbook build |
112 | 112 |
|
113 | | - - name: Setup Pages |
114 | | - uses: actions/configure-pages@v4 |
115 | 113 | - name: Upload artifact |
116 | | - uses: actions/upload-pages-artifact@v3 |
| 114 | + uses: actions/upload-artifact@v4 |
117 | 115 | with: |
| 116 | + name: book |
118 | 117 | path: book |
119 | | - - name: Deploy to Github Pages |
120 | | - uses: actions/deploy-pages@v4 |
121 | 118 |
|
122 | 119 | check_and_test: |
123 | 120 | needs: files_changed |
@@ -583,3 +580,57 @@ jobs: |
583 | 580 | rayhunter-v${{ env.VERSION }}-${{ matrix.platform }}.zip |
584 | 581 | rayhunter-v${{ env.VERSION }}-${{ matrix.platform }}.zip.sha256 |
585 | 582 | if-no-files-found: error |
| 583 | + |
| 584 | + openapi_build: |
| 585 | + if: needs.files_changed.outputs.docs_changed == 'true' |
| 586 | + needs: |
| 587 | + - files_changed |
| 588 | + permissions: |
| 589 | + contents: write |
| 590 | + runs-on: ubuntu-latest |
| 591 | + steps: |
| 592 | + - uses: actions/checkout@v4 |
| 593 | + with: |
| 594 | + persist-credentials: false |
| 595 | + - uses: dtolnay/rust-toolchain@stable |
| 596 | + with: |
| 597 | + targets: armv7-unknown-linux-musleabihf |
| 598 | + - uses: Swatinem/rust-cache@v2 |
| 599 | + - name: Build rayhunter-daemon openapi docs |
| 600 | + run: | |
| 601 | + mkdir -p daemon/web/build |
| 602 | + touch daemon/web/build/{favicon.png,index.html.gz,rayhunter_orca_only.png,rayhunter_text.png} |
| 603 | + cargo run --bin gen_api --features apidocs -- ./rayhunter-openapi.json |
| 604 | + - name: Make swagger folder |
| 605 | + run: | |
| 606 | + mkdir api-docs |
| 607 | + mv doc/swagger-ui.html api-docs/index.html |
| 608 | + mv rayhunter-openapi.json api-docs/ |
| 609 | + - uses: actions/upload-artifact@v4 |
| 610 | + with: |
| 611 | + name: api-docs |
| 612 | + path: api-docs |
| 613 | + |
| 614 | + github_pages_publish: |
| 615 | + name: Upload new documentation to Github Pages |
| 616 | + if: ${{ github.ref == 'refs/heads/main' }} |
| 617 | + permissions: |
| 618 | + pages: write |
| 619 | + contents: write |
| 620 | + id-token: write |
| 621 | + needs: |
| 622 | + - mdbook_build |
| 623 | + - openapi_build |
| 624 | + runs-on: ubuntu-latest |
| 625 | + steps: |
| 626 | + - name: Setup Pages |
| 627 | + uses: actions/configure-pages@v4 |
| 628 | + - uses: actions/download-artifact@v4 |
| 629 | + - name: Organize pages into directory |
| 630 | + run: cp -a api-docs book/ |
| 631 | + - name: Upload pages |
| 632 | + uses: actions/upload-pages-artifact@v3 |
| 633 | + with: |
| 634 | + path: book |
| 635 | + - name: Deploy Github Pages |
| 636 | + uses: actions/deploy-pages@v4 |
0 commit comments