|
1 | | -name: Generate Documentation |
2 | | -permissions: |
3 | | - contents: write |
| 1 | +name: Build Documentation |
4 | 2 |
|
5 | 3 | on: |
6 | 4 | push: |
7 | 5 | branches: |
8 | | - - master |
| 6 | + - dev-v4 |
9 | 7 | paths-ignore: |
10 | | - - 'docs/**' |
11 | | - - '.github/**' |
| 8 | + - 'docs/**' |
| 9 | +# - '.github/**' |
| 10 | + pull_request: |
12 | 11 |
|
13 | 12 | jobs: |
14 | | - build: |
15 | | - runs-on: windows-2022 |
16 | | - |
| 13 | + build-docs: |
| 14 | + runs-on: ubuntu-latest |
| 15 | + |
17 | 16 | steps: |
18 | | - - name: Install checkout |
19 | | - uses: actions/checkout@v3 |
20 | | - with: |
21 | | - token: ${{ secrets.PUSH_TOKEN }} |
22 | | - |
23 | | - - name: Check build origin and author |
24 | | - id: check_build_origin_and_author |
25 | | - shell: powershell |
26 | | - run: | |
27 | | - $email = git config --global user.email |
28 | | - $name = git config --global user.name |
29 | | - if ($email -eq "actions@github.com" -and $name -eq "GitHub Actions") { |
30 | | - echo "build_origin=skip" >> $env:GITHUB_ENV |
31 | | - Write-Host "Skipping step because the last commit was system triggered" |
32 | | - echo "build_origin=skip" >> $env:GITHUB_ENV |
33 | | - exit 0 |
34 | | - } else { |
35 | | - echo "build_origin=pass" >> $env:GITHUB_ENV |
36 | | - exit 0 |
37 | | - } |
| 17 | + - name: Checkout |
| 18 | + uses: actions/checkout@v4 |
| 19 | + with: |
| 20 | + token: ${{ secrets.PUSH_TOKEN }} |
| 21 | + |
| 22 | + # Move static files locally |
| 23 | + - name: Prepare docs folder |
| 24 | + run: | |
| 25 | + mkdir -p docs |
| 26 | + mv Docs.IndexGenerator/Output/* docs/ |
| 27 | +
|
| 28 | + # Pull current v3 docs from master branch |
| 29 | + - name: Checkout master docs |
| 30 | + uses: actions/checkout@v4 |
| 31 | + with: |
| 32 | + ref: master |
| 33 | + path: master_docs |
38 | 34 |
|
39 | | - - name: Build PicoXLSX project |
40 | | - if: ${{ env.build_origin }} == 'pass' |
41 | | - run: dotnet build "PicoXLSX/PicoXLSX.csproj" -c Debug |
42 | | - |
43 | | - - name: Add msbuild to PATH |
44 | | - if: ${{ env.build_origin }} == 'pass' |
45 | | - uses: microsoft/setup-msbuild@v1.1 |
| 35 | + # Copy v3 docs to /docs/v2 |
| 36 | + - name: Add legacy v2 documentation |
| 37 | + run: | |
| 38 | + mkdir -p docs/v3 |
| 39 | + cp -r master_docs/docs/* docs/v3/ |
46 | 40 |
|
47 | | - - name: Install SHFB |
48 | | - if: ${{ env.build_origin }} == 'pass' |
49 | | - uses: Bassman2/setup-SHFB@v1 |
50 | | - with: |
51 | | - version: 2023.3.4.0 |
52 | | - |
53 | | - - name: Clean up docs folder |
54 | | - shell: powershell |
55 | | - run: Remove-Item -Path docs/* -Recurse -Force |
| 41 | + # Upload docs artifact |
| 42 | + - name: Upload docs artifact |
| 43 | + uses: actions/upload-artifact@v4 |
| 44 | + with: |
| 45 | + name: docs |
| 46 | + path: docs/ |
56 | 47 |
|
57 | | - - name: Generate documentation |
58 | | - if: ${{ env.build_origin }} == 'pass' |
59 | | - run: msbuild Documentation/CodeDocumentation.shfbproj /p:configuration="Release" /m /verbosity:minimal |
60 | | - |
61 | | - - name: Push changes to GitHub |
62 | | - if: ${{ env.build_origin }} == 'pass' |
63 | | - env: |
64 | | - GITHUB_TOKEN: ${{ secrets.PUSH_TOKEN }} |
65 | | - run: | |
66 | | - git config --global user.email "actions@github.com" |
67 | | - git config --global user.name "GitHub Actions" |
68 | | - git add -f docs/ |
69 | | - git commit -m "Update documentation" |
70 | | - git push |
71 | | - |
72 | | - - name: Clean up docs folder |
73 | | - shell: powershell |
74 | | - run: Remove-Item -Path docs/* -Recurse -Force |
| 48 | + - name: Deploy to GitHub Pages |
| 49 | + uses: peaceiris/actions-gh-pages@v3 |
| 50 | + with: |
| 51 | + github_token: ${{ secrets.PUSH_TOKEN }} |
| 52 | + publish_dir: ./docs |
| 53 | + publish_branch: gh-pages |
0 commit comments