Skip to content

Commit 338129e

Browse files
committed
Add a GHA workflow to deploy the site
1 parent fc8d1d9 commit 338129e

File tree

4 files changed

+76
-13
lines changed

4 files changed

+76
-13
lines changed

.github/workflows/publish.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Publish to GitHub Pages
2+
on:
3+
push:
4+
branches: [master]
5+
# Allows you to run this workflow manually from the Actions tab
6+
workflow_dispatch:
7+
concurrency:
8+
group: github-pages
9+
cancel-in-progress: false
10+
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
11+
permissions:
12+
contents: read
13+
pages: write
14+
id-token: write
15+
jobs:
16+
build:
17+
runs-on: ubuntu-latest
18+
environment:
19+
name: github-pages
20+
url: ${{ steps.deployment.outputs.page_url }}
21+
steps:
22+
- name: Checkout repository
23+
uses: actions/checkout@v4
24+
- name: Configure Pages
25+
uses: actions/configure-pages@v5
26+
- name: Install Node.js
27+
uses: actions/setup-node@v4
28+
with:
29+
node-version: "18"
30+
- name: Install Antora
31+
run: npm i antora
32+
- name: Generate Site
33+
run: npx antora antora-playbook.yml
34+
- name: Upload Artifacts
35+
uses: actions/upload-pages-artifact@v3
36+
with:
37+
path: build/site
38+
- name: Deploy to GitHub Pages
39+
id: deployment
40+
uses: actions/deploy-pages@v4

Makefile

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,3 @@ npm: package.json
77

88
build: npm
99
npm run antora -- --fetch antora-playbook.yml
10-
11-
deploy: build
12-
git add docs
13-
git commit -m 'Update site docs'
14-
git push

README.adoc

Lines changed: 35 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
The site is generated from the AsciiDoc files in the link:https://github.com/nrepl/nrepl/tree/master/doc[doc] folder of nREPL's GitHub repo and is published to https://nrepl.org.
44
link:https://antora.org[Antora] is used to convert the manual into HTML.
5-
The filesystem layout is described at https://docs.antora.org/antora/2.0/component-structure/
5+
The filesystem layout is described at https://docs.antora.org/antora/3.1/component-structure/
66

77
To make changes to the manual you simply have to change the files under `doc`.
88
The manual will be regenerated manually periodically.
@@ -19,16 +19,44 @@ $ cd nrepl.org
1919
$ make build
2020
----
2121

22-
After you're done with the initial setup you can use `make` to push changes to the site:
22+
To check the generated site you can simply open `build/site/index.html` in your favourite browser.
23+
24+
== Deploying the Site
25+
26+
NOTE: You'll need commit access to the repository for this to work.
27+
28+
The site is automatically deployed to GitHub pages using a GitHub Action.
29+
The action will be triggered by any push to the `master` branch.
30+
It can also be triggered manually if needed.
31+
32+
== Using Docker
33+
34+
If you prefer not to install Antora on your local machine, you can build the documentation
35+
inside a Docker container like this:
2336

2437
[source]
2538
----
26-
$ make deploy
39+
$ docker run --rm -t -v $(pwd):/build/site antora/antora:3.1.10 --fetch /docs/antora-playbook.yml
2740
----
2841

29-
NOTE: You'll need commit access to the repository for this to work.
42+
== Updating the Playbook
43+
44+
When cutting new releases you'll have to updated `antora-playbook.yml` to mention
45+
their relevant tags from which the documentation needs to be build. Here's how this
46+
looks for one of the projects:
47+
48+
[source]
49+
----
50+
- url: https://github.com/nrepl/nrepl.git
51+
branches: master
52+
tags: ['v1.7.0', 'v1.8.0']
53+
start_path: docs
54+
----
55+
56+
TIP: You need to add one such block for each new nREPL module you're adding to the docs site.
3057

31-
To check the generated site you can simply open `docs/index.html` in your favourite browser.
58+
== Troubleshooting
3259

33-
If you want to make changes to the manual's page structure you'll have to edit
34-
link:https://github.com/nrepl/nrepl/blob/master/doc/modules/ROOT/nav.adoc[nav.adoc].
60+
The most common mistake that people make is to forget to update the version of an Antora docs module
61+
after cutting a release. This will result in an error saying you've got the same version in two branches (e.g. `master`
62+
and `v1.0`). Fixing this is pretty simple - just update the version to `master` in `antora.yml`.

antora-playbook.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,4 @@ ui:
2424
snapshot: true
2525
supplemental_files: ./supplemental-ui
2626
output:
27-
dir: ./docs
27+
dir: build/site

0 commit comments

Comments
 (0)