Skip to content

Commit 8f534a2

Browse files
committed
ci: deploy fails because of missing public/ dir
Problem: Since moving to `peaceiris/actions-gh-pages` #401 there is a new problem: /home/runner/actions_github_pages_1764026989086 cp: no such file or directory: /home/runner/work/neovim.github.io/neovim.github.io/public/* cp: no such file or directory: /home/runner/work/neovim.github.io/neovim.github.io/public/.* The old way magically worked because `actions/upload-pages-artifact` is internally handled by `actions/deploy-pages`. There is no complementary `actions/download-pages-artifact` so we have to do some other approach. Solution: Do the build in the deploy step, avoid uploading/downloading artifacts.
1 parent e0d2cf4 commit 8f534a2

File tree

4 files changed

+93
-79
lines changed

4 files changed

+93
-79
lines changed

.github/actions/build.yaml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: "Build Hugo Site"
2+
description: "Shared Hugo build logic"
3+
4+
env:
5+
HUGO_VERSION: "0.152.2"
6+
7+
runs:
8+
using: "composite"
9+
steps:
10+
- name: Install Hugo CLI
11+
run: |
12+
wget -O ${{ runner.temp }}/hugo.deb \
13+
https://github.com/gohugoio/hugo/releases/download/v${{ env.HUGO_VERSION }}/hugo_extended_${{ env.HUGO_VERSION }}_linux-amd64.deb \
14+
&& sudo dpkg -i ${{ runner.temp }}/hugo.deb
15+
- name: Checkout
16+
uses: actions/checkout@v6
17+
with:
18+
submodules: recursive
19+
fetch-depth: 0
20+
- name: Build with Hugo
21+
env:
22+
# For backward compatibility with Hugo modules
23+
HUGO_ENVIRONMENT: production
24+
HUGO_ENV: production
25+
run: |
26+
hugo --gc --minify --baseURL "$BASE_URL"

.github/workflows/build.yaml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Builds but does not deploy, for pull request validation.
2+
3+
name: build
4+
5+
on:
6+
# Runs on pull requests
7+
pull_request:
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Build site
14+
uses: ./.github/actions/build-site
15+
env:
16+
BASE_URL: "https://example.com/"

.github/workflows/deploy.yaml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# Builds and deploys the site to GitHub Pages.
2+
# Does NOT run on pull requests.
3+
4+
name: build-and-deploy
5+
6+
on:
7+
# Runs on pushes targeting the default branch
8+
push:
9+
branches:
10+
- master
11+
12+
# Allows you to run this workflow manually from the Actions tab
13+
workflow_dispatch:
14+
15+
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
16+
permissions:
17+
contents: read
18+
pages: write
19+
id-token: write
20+
21+
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
22+
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
23+
concurrency:
24+
group: "pages"
25+
cancel-in-progress: false
26+
27+
# Default to bash
28+
defaults:
29+
run:
30+
shell: bash
31+
32+
jobs:
33+
# Deployment job
34+
build-and-deploy:
35+
runs-on: ubuntu-latest
36+
permissions:
37+
contents: write
38+
# environment:
39+
# name: github-pages
40+
# url: ${{ steps.deployment.outputs.page_url }}
41+
steps:
42+
- name: Build site
43+
uses: ./.github/actions/build-site
44+
env:
45+
BASE_URL: "${{ steps.pages.outputs.base_url }}/"
46+
- name: Deploy
47+
id: deployment
48+
uses: peaceiris/actions-gh-pages@v4
49+
with:
50+
publish_dir: ./public
51+
github_token: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/hugo.yaml

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

0 commit comments

Comments
 (0)