Skip to content

Commit 671aac2

Browse files
authored
Merge branch 'master' into leecalcote-patch-3
2 parents b81815b + cc7fa04 commit 671aac2

File tree

11 files changed

+194
-83
lines changed

11 files changed

+194
-83
lines changed
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: Build and Deploy Site
2+
3+
on:
4+
push:
5+
branches: [master]
6+
workflow_dispatch:
7+
8+
permissions:
9+
contents: write
10+
11+
defaults:
12+
run:
13+
shell: bash
14+
15+
jobs:
16+
build-and-deploy-site:
17+
runs-on: ubuntu-latest
18+
19+
steps:
20+
- name: Checkout
21+
uses: actions/checkout@v6
22+
with:
23+
fetch-depth: 0
24+
25+
- name: Setup Go
26+
uses: actions/setup-go@v5
27+
with:
28+
go-version-file: go.mod
29+
cache: true
30+
31+
- name: Setup Hugo Extended
32+
uses: peaceiris/actions-hugo@v3
33+
with:
34+
hugo-version: '0.158.0'
35+
extended: true
36+
37+
- name: Setup Node
38+
uses: actions/setup-node@v4
39+
with:
40+
node-version: '20'
41+
cache: 'npm'
42+
43+
- name: Setup site dependencies
44+
run: make setup
45+
46+
- name: Build site
47+
run: make build-production BASE_URL="https://${{ github.repository_owner }}.github.io/${{ github.event.repository.name }}/"
48+
49+
- name: Prepare Pages output
50+
run: touch public/.nojekyll
51+
52+
- name: Deploy site to GitHub Pages
53+
uses: peaceiris/actions-gh-pages@v4
54+
with:
55+
github_token: ${{ secrets.GITHUB_TOKEN }}
56+
publish_branch: gh-pages
57+
publish_dir: ./public
58+
keep_files: true
Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
name: Build and Preview Site
2+
3+
on:
4+
pull_request_target:
5+
branches: [master]
6+
types: [opened, synchronize, reopened, closed]
7+
8+
permissions:
9+
contents: write
10+
pull-requests: write
11+
12+
concurrency:
13+
group: preview-${{ github.event.pull_request.number || github.run_id }}
14+
cancel-in-progress: true
15+
16+
defaults:
17+
run:
18+
shell: bash
19+
20+
jobs:
21+
build-and-deploy-preview:
22+
runs-on: ubuntu-latest
23+
24+
steps:
25+
- name: Checkout PR code
26+
if: github.event.action != 'closed'
27+
uses: actions/checkout@v6
28+
with:
29+
repository: ${{ github.event.pull_request.head.repo.full_name }}
30+
ref: ${{ github.event.pull_request.head.sha }}
31+
persist-credentials: false
32+
fetch-depth: 0
33+
34+
- name: Checkout for cleanup
35+
if: github.event.action == 'closed'
36+
uses: actions/checkout@v6
37+
with:
38+
ref: gh-pages
39+
fetch-depth: 0
40+
41+
- name: Setup Go
42+
if: github.event.action != 'closed'
43+
uses: actions/setup-go@v5
44+
with:
45+
go-version-file: go.mod
46+
cache: true
47+
48+
- name: Setup Hugo Extended
49+
if: github.event.action != 'closed'
50+
uses: peaceiris/actions-hugo@v3
51+
with:
52+
hugo-version: '0.158.0'
53+
extended: true
54+
55+
- name: Setup Node
56+
if: github.event.action != 'closed'
57+
uses: actions/setup-node@v4
58+
with:
59+
node-version: '20'
60+
cache: 'npm'
61+
62+
- name: Setup site dependencies
63+
if: github.event.action != 'closed'
64+
run: make setup
65+
66+
- name: Build PR preview
67+
if: github.event.action != 'closed'
68+
run: |
69+
make build-preview BASE_URL="https://${{ github.repository_owner }}.github.io/${{ github.event.repository.name }}/pr-preview/pr-${{ github.event.pull_request.number }}/"
70+
touch public/.nojekyll
71+
72+
- name: Deploy PR preview
73+
if: github.event.action != 'closed'
74+
uses: rossjrw/pr-preview-action@v1.6.3
75+
with:
76+
source-dir: ./public
77+
preview-branch: gh-pages
78+
umbrella-dir: pr-preview
79+
action: auto
80+
comment: false
81+
82+
- name: Comment PR with Preview URL
83+
if: github.event.action != 'closed'
84+
uses: marocchino/sticky-pull-request-comment@v2
85+
with:
86+
header: pr-preview
87+
message: |
88+
🚀 **Preview deployment for PR #${{ github.event.pull_request.number }}**
89+
90+
🌐 **Preview URL**: https://${{ github.repository_owner }}.github.io/${{ github.event.repository.name }}/pr-preview/pr-${{ github.event.pull_request.number }}/
91+
92+
_This preview will be updated automatically when you push new commits to this PR._
93+
94+
- name: Cleanup PR preview on close
95+
if: github.event.action == 'closed'
96+
uses: rossjrw/pr-preview-action@v1.6.3
97+
with:
98+
preview-branch: gh-pages
99+
umbrella-dir: pr-preview
100+
action: remove

.github/workflows/gh-pages.yml

Lines changed: 0 additions & 72 deletions
This file was deleted.

Makefile

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,32 @@ include .github/build/Makefile.show-help.mk
1818
#----------------------------------------------------------------------------
1919
# Academy
2020
# ---------------------------------------------------------------------------
21-
.PHONY: setup build site clean check-go theme-update
21+
.PHONY: setup build build-production build-preview site clean check-go theme-update
22+
23+
BASE_URL ?=
2224

2325
## ------------------------------------------------------------
2426
----LOCAL_BUILDS: Show help for available targets
2527

2628
## Local: Install site dependencies
2729
setup:
28-
npm i
30+
@if [ -f package-lock.json ] || [ -f npm-shrinkwrap.json ]; then \
31+
npm ci; \
32+
else \
33+
npm i; \
34+
fi
2935

3036
## Local: Build site for local consumption
3137
build:
32-
hugo build
38+
BASE_URL="$(BASE_URL)" npm run build
39+
40+
## CI: Build production site output
41+
build-production:
42+
BASE_URL="$(BASE_URL)" npm run build:production
43+
44+
## CI: Build preview site output and mark it non-indexable
45+
build-preview:
46+
BASE_URL="$(BASE_URL)" npm run build:preview
3347

3448
## Local: Build and run site locally with draft and future content enabled.
3549
site: check-go

content/content-formatting-examples/hextra/asciinema/index.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ Embeds an [asciinema](https://asciinema.org/) terminal recording player. The pla
2323
| `loop` | Loop playback | `false` |
2424
| `poster` | Poster/thumbnail specification | _(none)_ |
2525
| `markers` | Comma-separated time markers (e.g., `"5:Intro,10:Demo"`) | _(none)_ |
26+
| `filename` | Optional filename to display as a header | _(none)_ |
2627

2728
**Example:**
2829

29-
{{< hextra/asciinema file="demo.cast" speed="2" autoplay="true" loop="true" >}}
30+
{{< hextra/asciinema file="demo.cast" speed="2" autoplay="true" loop="true" filename="terminal-session.cast" >}}

content/content-formatting-examples/hextra/jupyter/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ Renders a Jupyter Notebook (`.ipynb`) as code blocks and Markdown cells.
1818
|-----------|-------------|---------|
1919
| positional | Path or URL to the `.ipynb` file | _(required)_ |
2020
| `allowUnsafeHTML` | Set to `"true"` to render raw HTML from notebook outputs | `false` |
21+
| `filename` | Optional filename to display as a header | _(none)_ |
2122

2223
**Example:**
2324

content/content-formatting-examples/markdown/code.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,12 @@ draft: true
1010
This is a code block.
1111
```
1212

13+
### Code block with filename
14+
15+
```go {filename="main.go"}
16+
package main
17+
import "fmt"
18+
func main() { fmt.Println("hello") }
19+
```
20+
1321
Inline code like `var foo = "bar";` is supported.

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@ replace github.com/FortAwesome/Font-Awesome v4.7.0+incompatible => github.com/Fo
99

1010
require (
1111
github.com/FortAwesome/Font-Awesome v4.7.0+incompatible // indirect
12-
github.com/layer5io/academy-theme v0.4.5 // indirect
12+
github.com/layer5io/academy-theme v0.4.6 // indirect
1313
github.com/twbs/bootstrap v5.3.7+incompatible // indirect
1414
)

go.sum

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,7 @@ github.com/layer5io/academy-theme v0.4.2 h1:uwaXj61bXLwWFHD8wAncQbtMiqvbbE24pKE2
2828
github.com/layer5io/academy-theme v0.4.2/go.mod h1:Dv72UWsREOvX4Zg4mJjrpoyDxdgxxpiDotxqYBXMjXo=
2929
github.com/layer5io/academy-theme v0.4.5 h1:SfjQ63uYxgtsqdo8qPjvr7/9ygkMQZK80BO+6piWUaQ=
3030
github.com/layer5io/academy-theme v0.4.5/go.mod h1:Dv72UWsREOvX4Zg4mJjrpoyDxdgxxpiDotxqYBXMjXo=
31+
github.com/layer5io/academy-theme v0.4.6 h1:SYCqM+THVyl5nOEs8WTV4rjoa7d1SZOn+K0gBE0fIu0=
32+
github.com/layer5io/academy-theme v0.4.6/go.mod h1:Dv72UWsREOvX4Zg4mJjrpoyDxdgxxpiDotxqYBXMjXo=
3133
github.com/twbs/bootstrap v5.3.7+incompatible h1:ea1W8TOWZFkqSK2M0McpgzLiUQVru3bz8aHb0j/XtuM=
3234
github.com/twbs/bootstrap v5.3.7+incompatible/go.mod h1:fZTSrkpSf0/HkL0IIJzvVspTt1r9zuf7XlZau8kpcY0=

hugo.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ markup:
1111
module:
1212
hugoVersion:
1313
extended: true
14-
min: 0.146.0
14+
min: 0.156.0
1515
imports:
1616

1717
# used to source the base theme for academy.

0 commit comments

Comments
 (0)