Skip to content

Commit bccab45

Browse files
committed
Fix build script for GitHub Actions environment
- Use GITHUB_WORKSPACE environment variable to find correct directory - Fall back to ~/blog for local development - Add debug output to diagnose build issues - Add error checking for public directory creation - Pass GITHUB_WORKSPACE to all workflow build steps This should fix the 'public: Cannot open: No such file or directory' error in GitHub Actions.
1 parent 737154f commit bccab45

4 files changed

Lines changed: 21 additions & 7 deletions

File tree

β€Ž.github/workflows/ci.ymlβ€Ž

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ jobs:
8686
./build.sh
8787
env:
8888
CI: true
89+
GITHUB_WORKSPACE: ${{ github.workspace }}
8990

9091
- name: Validate HTML output
9192
run: |

β€Ž.github/workflows/pr-preview.ymlβ€Ž

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ jobs:
5151
./build.sh
5252
env:
5353
CI: true
54+
GITHUB_WORKSPACE: ${{ github.workspace }}
5455

5556
- name: Generate sitemap
5657
run: |

β€Ž.github/workflows/publish.ymlβ€Ž

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,13 @@ jobs:
5757
- name: Build the site
5858
run: |
5959
chmod +x build.sh
60+
echo "Current directory: $(pwd)"
61+
echo "Directory contents:"
62+
ls -la
6063
./build.sh
6164
env:
6265
CI: true
66+
GITHUB_WORKSPACE: ${{ github.workspace }}
6367

6468
- name: Generate sitemap
6569
run: |
@@ -78,12 +82,20 @@ jobs:
7882
7983
- name: List generated files
8084
run: |
81-
echo "πŸ“ Generated files:"
82-
find public -type f -name "*.html" | sort
83-
echo ""
84-
echo "πŸ“Š Build statistics:"
85-
echo "Total HTML files: $(find public -name "*.html" | wc -l)"
86-
echo "Total size: $(du -sh public | cut -f1)"
85+
echo "πŸ“ Checking build output:"
86+
if [ -d "public" ]; then
87+
echo "βœ… public directory exists"
88+
find public -type f -name "*.html" | sort
89+
echo ""
90+
echo "πŸ“Š Build statistics:"
91+
echo "Total HTML files: $(find public -name "*.html" | wc -l)"
92+
echo "Total size: $(du -sh public | cut -f1)"
93+
else
94+
echo "❌ public directory not found!"
95+
echo "Current directory contents:"
96+
ls -la
97+
exit 1
98+
fi
8799
88100
- name: Setup Pages
89101
uses: actions/configure-pages@v4

β€Žbuild.shβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ if emacs --batch \
3131
--eval "
3232
(progn
3333
;; Set up directories
34-
(setq blog-directory \"~/blog/\")
34+
(setq blog-directory (file-name-as-directory (or (getenv \"GITHUB_WORKSPACE\") (expand-file-name \"~/blog\"))))
3535
(setq blog-posts-directory (concat blog-directory \"posts/\"))
3636
(setq blog-publish-directory (concat blog-directory \"public/\"))
3737
(setq blog-static-directory (concat blog-directory \"static/\"))

0 commit comments

Comments
Β (0)