Skip to content

Commit 6bfe25c

Browse files
Update generate-documentation.yml
1 parent 3aa1635 commit 6bfe25c

1 file changed

Lines changed: 42 additions & 63 deletions

File tree

Lines changed: 42 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -1,74 +1,53 @@
1-
name: Generate Documentation
2-
permissions:
3-
contents: write
1+
name: Build Documentation
42

53
on:
64
push:
75
branches:
8-
- master
6+
- dev-v4
97
paths-ignore:
10-
- 'docs/**'
11-
- '.github/**'
8+
- 'docs/**'
9+
# - '.github/**'
10+
pull_request:
1211

1312
jobs:
14-
build:
15-
runs-on: windows-2022
16-
13+
build-docs:
14+
runs-on: ubuntu-latest
15+
1716
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
3834

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/
4640
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/
5647

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

Comments
 (0)