Skip to content

Commit e7c4845

Browse files
add redirects to gh-pages
1 parent 8b08f7d commit e7c4845

File tree

2 files changed

+4617
-9
lines changed

2 files changed

+4617
-9
lines changed

.github/workflows/update-gh-pages-branch.yml

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,35 +2,49 @@ name: update gh-pages branch
22

33
on:
44
workflow_dispatch:
5-
5+
66
jobs:
7-
build-site:
7+
build-site:
88
runs-on: windows-latest
99
steps:
1010
- name: Checkout branch
1111
uses: actions/checkout@v4
12-
12+
1313
- name: Check status
1414
run: git status
15-
15+
1616
- name: Download docfx
1717
run: curl https://github.com/dotnet/docfx/releases/download/v2.77.0/docfx-win-x64-v2.77.0.zip -L -o ../docfx-win-x64-v2.77.0.zip
18-
18+
1919
- name: Expand docfx
2020
run: Expand-Archive ../docfx-win-x64-v2.77.0.zip -DestinationPath ../docfx
21-
21+
22+
- name: Create redirect files from redirects.json
23+
run: |
24+
$json = Get-Content redirects.json -Raw | ConvertFrom-Json
25+
foreach ($item in $json) {
26+
$file = $item.file
27+
$targethref = $item.targethref
28+
$dirPath = Split-Path -Path $file -Parent
29+
if ($dirPath -and -not (Test-Path $dirPath)) {
30+
New-Item -ItemType Directory -Path $dirPath -Force | Out-Null
31+
}
32+
$content = "---`nredirect_url: $targethref`n---`n"
33+
Set-Content -Path $file -Value $content -Force
34+
}
35+
2236
- name: Build site with docfx
2337
run: "../docfx/docfx.exe build docfx.json -m _matomoContainerUrl=\"https://matomo.devexpress.com/js/container_kE7MWPi0.js\" --warningsAsErrors"
24-
38+
2539
- name: Archive site
2640
run: Compress-Archive -Path _site/* -DestinationPath ${{ runner.temp }}/site.zip
27-
41+
2842
- name: Upload artifact
2943
uses: actions/upload-artifact@v4
3044
with:
3145
name: github-pages
3246
path: ${{ runner.temp }}/site.zip
33-
47+
3448
publish-pages:
3549
needs: build-site
3650
runs-on: windows-latest

0 commit comments

Comments
 (0)