Skip to content

Commit ff2883a

Browse files
authored
Add Rust for Windows book and create unified docs/web area (#3733)
1 parent df8a1e9 commit ff2883a

92 files changed

Lines changed: 14324 additions & 82 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitattributes

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,7 @@
66
*.lib -text
77
*.a -text
88
*.exe -text
9+
*.eot binary
10+
*.ttf binary
11+
*.woff binary
12+
*.woff2 binary

.github/workflows/web.yml

Lines changed: 42 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -1,81 +1,60 @@
11
name: web
22

33
permissions:
4-
contents: write
4+
contents: read
5+
pages: write
6+
id-token: write
57

68
on:
7-
pull_request:
8-
paths: [web/**]
9-
types: [opened, synchronize, reopened, closed]
109
push:
11-
paths: [web/**]
1210
branches: [master]
13-
workflow_dispatch:
11+
paths: ["web/**"]
12+
pull_request:
13+
paths: ["web/**"]
1414

1515
jobs:
1616
web:
17-
if: github.repository == 'microsoft/windows-rs'
18-
runs-on: ubuntu-22.04
17+
runs-on: ubuntu-latest
1918
steps:
20-
- uses: actions/checkout@v5
21-
with:
22-
path: current
19+
- name: Get sources
20+
uses: actions/checkout@v4
2321

24-
- uses: actions/setup-node@v4
22+
- name: Setup node
23+
uses: actions/setup-node@v4
2524
with:
26-
node-version: 'latest'
25+
node-version: "latest"
2726

28-
- name: Build sites
29-
shell: pwsh
27+
- name: Setup mdBook
3028
run: |
31-
cd current/web
32-
$sites = Get-ChildItem -Directory
33-
foreach ($site in $sites) {
34-
Write-Host "Building $($site.Name)"
35-
./build.ps1 $site.Name
36-
}
37-
38-
- uses: actions/checkout@v5
39-
with:
40-
ref: gh-pages
41-
path: gh-pages
29+
cargo install mdbook
4230
43-
- name: Update gh-pages
44-
shell: pwsh
31+
- name: Build
32+
working-directory: web
4533
run: |
46-
cd gh-pages
47-
48-
$sites = Get-ChildItem ../current/web -Directory
49-
foreach ($site in $sites) {
50-
Write-Host "Deploying $($site.Name)"
51-
52-
if ("${{ github.event_name }}" -eq "pull_request") {
53-
if ("${{ github.event.action }}" -eq "closed") {
54-
Remove-Item -Recurse -Force -ErrorAction Ignore "$($site.Name)/preview/pr-${{ github.event.number }}"
55-
} else {
56-
if (Test-Path "$($site.FullName)/build") {
57-
$previewPath = "$($site.Name)/preview/pr-${{ github.event.number }}"
58-
New-Item -ItemType Directory -Force $previewPath | Out-Null
59-
Remove-Item -Recurse -Force -ErrorAction Ignore "$previewPath/*"
60-
Copy-Item "$($site.FullName)/build/*" $previewPath -Recurse -Force
61-
}
62-
}
63-
} elseif ("${{ github.ref }}" -eq "refs/heads/master") {
64-
if (Test-Path "$($site.FullName)/build") {
65-
New-Item -ItemType Directory -Force $site.Name | Out-Null
66-
Get-ChildItem "$($site.Name)/*" -Exclude "preview" | Remove-Item -Recurse -Force -ErrorAction Ignore
67-
Copy-Item "$($site.FullName)/build/*" $site.Name -Recurse -Force
68-
}
69-
}
70-
}
71-
72-
git config user.name "github-actions[bot]"
73-
git config user.email "github-actions[bot]@users.noreply.github.com"
74-
git remote set-url origin https://github.com/${{ github.repository }}
34+
mkdir -p .build/features .build/book
35+
36+
# Copy static files
37+
cp -r static/* .build/
38+
39+
# Build book
40+
pushd book
41+
mdbook build --dest-dir ../.build/book
42+
popd
43+
44+
# Build feature tool
45+
pushd features
46+
npm ci
47+
npm run build
48+
cp -r build/* ../.build/features/
49+
popd
50+
51+
- name: Upload Pages artifact
52+
if: github.event_name != 'pull_request'
53+
uses: actions/upload-pages-artifact@v4
54+
with:
55+
path: ./web/.build
7556

76-
$status = git status --porcelain
77-
if ($status) {
78-
git add .
79-
git commit -m "Update from ${{ github.sha }}"
80-
git push
81-
}
57+
- name: Deploy to GitHub Pages
58+
if: github.event_name != 'pull_request'
59+
id: deployment
60+
uses: actions/deploy-pages@v4

web/book/book.toml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
[book]
2+
title = "Kenny Kerr"
3+
4+
[build]
5+
build-dir = "docs"
6+
7+
[output.html]
8+
cname = "kennykerr.ca"
9+
git-repository-url = "https://github.com/kennykerr/blog"
10+
input-404 = "404.html"

web/book/docs/.nojekyll

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
This file makes sure that Github Pages doesn't process mdBook's output.

web/book/docs/404.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<script>
2+
window.location.hostname = "kennykerrca.wordpress.com";
3+
</script>

web/book/docs/CNAME

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
kennykerr.ca

web/book/docs/FontAwesome/css/font-awesome.css

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
162 KB
Binary file not shown.
162 KB
Binary file not shown.

web/book/docs/FontAwesome/fonts/fontawesome-webfont.svg

Lines changed: 2671 additions & 0 deletions
Loading

0 commit comments

Comments
 (0)