Skip to content

Commit 8913a7b

Browse files
authored
Fix GitHub Pages deployment (#193)
* Fix GitHub Pages deployment * Fix docs workflow for pull requests
1 parent 8f4c6eb commit 8913a7b

3 files changed

Lines changed: 32 additions & 13 deletions

File tree

.github/workflows/docs.yaml

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,13 @@ on:
2828
workflow_dispatch:
2929

3030
permissions:
31-
contents: write
31+
contents: read
32+
pages: write
33+
id-token: write
34+
35+
concurrency:
36+
group: pages
37+
cancel-in-progress: true
3238

3339
jobs:
3440
docs:
@@ -39,6 +45,9 @@ jobs:
3945
with:
4046
fetch-depth: 0
4147

48+
- name: Configure GitHub Pages
49+
uses: actions/configure-pages@v5
50+
4251
- name: Set up Hugo
4352
uses: peaceiris/actions-hugo@v3
4453
with:
@@ -47,10 +56,19 @@ jobs:
4756
- name: Build documentation site
4857
run: hugo build --gc --minify
4958

50-
- name: Deploy documentation site
51-
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
52-
uses: JamesIves/github-pages-deploy-action@v4
59+
- name: Upload documentation artifact
60+
uses: actions/upload-pages-artifact@v4
5361
with:
54-
branch: gh-pages
55-
folder: public
56-
clean: true
62+
path: public
63+
64+
deploy:
65+
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
66+
needs: docs
67+
runs-on: ubuntu-latest
68+
environment:
69+
name: github-pages
70+
url: ${{ steps.deployment.outputs.page_url }}
71+
steps:
72+
- name: Deploy documentation site
73+
id: deployment
74+
uses: actions/deploy-pages@v4

content/docs/release.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ title: "Release Process"
33
weight: 4
44
---
55

6-
The repository tracks release notes in `docs/RELEASE.md`, automates tagged releases with GitHub Actions, and publishes the documentation site through `gh-pages`.
6+
The repository tracks release notes in `docs/RELEASE.md`, automates tagged releases with GitHub Actions, and publishes the documentation site through GitHub Pages Actions.
77

88
## Commands
99

@@ -27,9 +27,9 @@ After the tag is pushed, verify that the `Release` workflow succeeds and that th
2727

2828
The documentation workflow lives in `.github/workflows/docs.yaml`.
2929

30-
When a docs-related change is pushed to `main`, GitHub Actions builds the Hugo site and deploys the generated `public/` directory to the `gh-pages` branch.
30+
When a docs-related change is pushed to `main`, GitHub Actions builds the Hugo site, uploads the generated `public/` directory as a Pages artifact, and deploys it through GitHub Pages.
3131

32-
For this to publish correctly, repository settings must point GitHub Pages at the `gh-pages` branch root.
32+
For this to publish correctly, repository settings must point GitHub Pages at GitHub Actions.
3333

3434
After a merge, verify that the `Docs` workflow succeeds and that the site is available at `https://skyoo2003.github.io/kvs/`.
3535

docs/RELEASE.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ After pushing the tag, confirm that the `Release` workflow succeeds and that the
3737

3838
## Documentation Site Release
3939

40-
The static documentation site is built with Hugo and published to the `gh-pages` branch.
40+
The static documentation site is built with Hugo and published through GitHub Pages Actions.
4141

4242
### Trigger
4343

@@ -56,11 +56,12 @@ The docs workflow runs on pushes to `main` when one of these paths changes:
5656

5757
1. GitHub Actions runs `.github/workflows/docs.yaml`
5858
2. Hugo builds the site into `public/`
59-
3. `JamesIves/github-pages-deploy-action` publishes `public/` to the `gh-pages` branch
59+
3. `actions/upload-pages-artifact` uploads `public/` as the Pages artifact
60+
4. `actions/deploy-pages` publishes that artifact to GitHub Pages
6061

6162
### Repository Setting
6263

63-
GitHub Pages must be configured to serve from the `gh-pages` branch root.
64+
GitHub Pages must be configured to deploy from GitHub Actions.
6465

6566
### Verification
6667

0 commit comments

Comments
 (0)