Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,7 @@
*.lib -text
*.a -text
*.exe -text
*.eot binary
*.ttf binary
*.woff binary
*.woff2 binary
105 changes: 42 additions & 63 deletions .github/workflows/web.yml
Original file line number Diff line number Diff line change
@@ -1,81 +1,60 @@
name: web

permissions:
contents: write
contents: read
pages: write
id-token: write

on:
pull_request:
paths: [web/**]
types: [opened, synchronize, reopened, closed]
push:
paths: [web/**]
branches: [master]
workflow_dispatch:
paths: ["web/**"]
pull_request:
paths: ["web/**"]

jobs:
web:
if: github.repository == 'microsoft/windows-rs'
runs-on: ubuntu-22.04
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
with:
path: current
- name: Get sources
uses: actions/checkout@v4

- uses: actions/setup-node@v4
- name: Setup node
uses: actions/setup-node@v4
with:
node-version: 'latest'
node-version: "latest"

- name: Build sites
shell: pwsh
- name: Setup mdBook
run: |
cd current/web
$sites = Get-ChildItem -Directory
foreach ($site in $sites) {
Write-Host "Building $($site.Name)"
./build.ps1 $site.Name
}

- uses: actions/checkout@v5
with:
ref: gh-pages
path: gh-pages
cargo install mdbook

- name: Update gh-pages
shell: pwsh
- name: Build
working-directory: web
run: |
cd gh-pages

$sites = Get-ChildItem ../current/web -Directory
foreach ($site in $sites) {
Write-Host "Deploying $($site.Name)"

if ("${{ github.event_name }}" -eq "pull_request") {
if ("${{ github.event.action }}" -eq "closed") {
Remove-Item -Recurse -Force -ErrorAction Ignore "$($site.Name)/preview/pr-${{ github.event.number }}"
} else {
if (Test-Path "$($site.FullName)/build") {
$previewPath = "$($site.Name)/preview/pr-${{ github.event.number }}"
New-Item -ItemType Directory -Force $previewPath | Out-Null
Remove-Item -Recurse -Force -ErrorAction Ignore "$previewPath/*"
Copy-Item "$($site.FullName)/build/*" $previewPath -Recurse -Force
}
}
} elseif ("${{ github.ref }}" -eq "refs/heads/master") {
if (Test-Path "$($site.FullName)/build") {
New-Item -ItemType Directory -Force $site.Name | Out-Null
Get-ChildItem "$($site.Name)/*" -Exclude "preview" | Remove-Item -Recurse -Force -ErrorAction Ignore
Copy-Item "$($site.FullName)/build/*" $site.Name -Recurse -Force
}
}
}

git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git remote set-url origin https://github.com/${{ github.repository }}
mkdir -p .build/features .build/book

# Copy static files
cp -r static/* .build/

# Build book
pushd book
mdbook build --dest-dir ../.build/book
popd

# Build feature tool
pushd features
npm ci
npm run build
cp -r build/* ../.build/features/
popd

- name: Upload Pages artifact
if: github.event_name != 'pull_request'
uses: actions/upload-pages-artifact@v4
with:
path: ./web/.build

$status = git status --porcelain
if ($status) {
git add .
git commit -m "Update from ${{ github.sha }}"
git push
}
- name: Deploy to GitHub Pages
if: github.event_name != 'pull_request'
id: deployment
uses: actions/deploy-pages@v4
10 changes: 10 additions & 0 deletions web/book/book.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[book]
title = "Kenny Kerr"

[build]
build-dir = "docs"

[output.html]
cname = "kennykerr.ca"
git-repository-url = "https://github.com/kennykerr/blog"
input-404 = "404.html"
1 change: 1 addition & 0 deletions web/book/docs/.nojekyll
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This file makes sure that Github Pages doesn't process mdBook's output.
3 changes: 3 additions & 0 deletions web/book/docs/404.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<script>
window.location.hostname = "kennykerrca.wordpress.com";
</script>
1 change: 1 addition & 0 deletions web/book/docs/CNAME
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
kennykerr.ca
4 changes: 4 additions & 0 deletions web/book/docs/FontAwesome/css/font-awesome.css

Large diffs are not rendered by default.

Binary file added web/book/docs/FontAwesome/fonts/FontAwesome.ttf
Binary file not shown.
Binary file not shown.
2,671 changes: 2,671 additions & 0 deletions web/book/docs/FontAwesome/fonts/fontawesome-webfont.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Binary file not shown.
78 changes: 78 additions & 0 deletions web/book/docs/ayu-highlight.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
/*
Based off of the Ayu theme
Original by Dempfi (https://github.com/dempfi/ayu)
*/

.hljs {
display: block;
overflow-x: auto;
background: #191f26;
color: #e6e1cf;
}

.hljs-comment,
.hljs-quote {
color: #5c6773;
font-style: italic;
}

.hljs-variable,
.hljs-template-variable,
.hljs-attribute,
.hljs-attr,
.hljs-regexp,
.hljs-link,
.hljs-selector-id,
.hljs-selector-class {
color: #ff7733;
}

.hljs-number,
.hljs-meta,
.hljs-builtin-name,
.hljs-literal,
.hljs-type,
.hljs-params {
color: #ffee99;
}

.hljs-string,
.hljs-bullet {
color: #b8cc52;
}

.hljs-title,
.hljs-built_in,
.hljs-section {
color: #ffb454;
}

.hljs-keyword,
.hljs-selector-tag,
.hljs-symbol {
color: #ff7733;
}

.hljs-name {
color: #36a3d9;
}

.hljs-tag {
color: #00568d;
}

.hljs-emphasis {
font-style: italic;
}

.hljs-strong {
font-weight: bold;
}

.hljs-addition {
color: #91b362;
}

.hljs-deletion {
color: #d96c75;
}
Loading