I am converting .md to .html and want to host these files on gh-pages. The problem is that jekyll-build-pages@v1 is being executed despite the presence of .nojekyll file and it throws an error since I don’t want to use it and my project is not intended for jekyll. Why?
ERROR:
Run actions/jekyll-build-pages@v1
with:
source: ./docs
destination: ./docs/_site
future: false
build_revision: f4c9e5c0cb46a994aeb7066e4f4f11c4596de8ff
verbose: true
token: ***
...
Configuration file: none
Logging at level: debug
GitHub Pages: github-pages v228
GitHub Pages: jekyll v3.9.3
Theme: jekyll-theme-primer
Theme source: /usr/local/bundle/gems/jekyll-theme-primer-0.6.0
Requiring: jekyll-github-metadata
To use retry middleware with Faraday v2.0+, install `faraday-retry` gem
Conversion error: Jekyll::Converters::Scss encountered an error while converting
'assets/css/style.scss':
No such file or directory @ dir_chdir - /github/workspace/docs
docs.yaml (gh-pages action):
name: Build and Deploy Docs
on:
push:
branches:
- master
- main
permissions:
contents: write
jobs:
build-and-deploy:
concurrency: ci-${{ github.ref }}
runs-on: ubuntu-latest
steps:
- name: Checkout 🛎️
uses: actions/checkout@v3
- name: Install pandoc
run: sudo apt-get update && sudo apt-get install pandoc
- uses: actions/setup-node@v3
with:
node-version: 18.x
- name: Install styling
run: npm install github-markdown-css
- name: Build 🔧
run: |
#!/bin/bash
mkdir dist
touch dist/.nojekyll
mv node_modules/github-markdown-css/github-markdown.css docs/github-markdown.css
cp docs/*.css dist/
if [ -d "docs/img/" ]; then
cp -r docs/img/ dist/img/
fi
for file in docs/*.md; do
name=$(basename "$file" .md)
pandoc "$file" -f markdown -t html -o "dist/$name.html"
done
for file in dist/*.html; do
name=$(basename "$file" .html)
content=$(cat "$file")
echo -e "<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Docs</title>
$(for cssfile in dist/*.css; do
cssname=$(basename "$cssfile")
if [[ "$cssname" != "github-markdown.css" && "$cssname" != "style.css" ]]; then
echo "<link rel="stylesheet" href="./$cssname">"
fi
done)
<link rel="stylesheet" href="./github-markdown.css">
<link rel="stylesheet" href="./style.css">
</head>
<body class="markdown-body">
${content}
</body>
</html>" > "dist/$name.html"
done
- name: Deploy 🚀
uses: JamesIves/github-pages-deploy-action@v4
with:
folder: dist
branch: docs
2
Answers
https://github.com/-username-/-project-/settings/pages > Build and deployment
Source: "Deploy from branch" Branch: "branch": docs and "folder": docs was selected (changed it to (root)), but no docs folder exists in the docs branch (the error message makes sense now...). Thank you GitHub for letting me choose a folder that doesn't exist :/. I feel really dumb rn.
Make sure that your
.nojekyll
file is in the root directory. Additionally, you may need to manually commit the file to yourgh-pages
branch. Finally, consider altering your build process such that it generates the.nojekyll
itself prior to the GitHub pages push if possible. I personally find this to be a cleaner solution as the build process doesn’t change based on some magic file that someone may not know about; everything affecting it is one place.