Open KonnorRogers opened 1 year ago
Just making a note here we should either commit to updating docs to support GH Pages or make a note we don't offer support for GH Pages. Adding the 2.0 milestone.
@KonnorRogers I followed these steps, but the Github workflow hit an error at:
yarn install --immutable --check-cache
Do you have any suggestions? ( I started off with a clean set of files... bridgetown new mysite
...)
It turns out I was using Yarn Classic and upgrading to Yarn Modern (berry) solves the problem.
Motivation
GitHub Pages is currently not the easiest to setup with a number of gotchas.
Suggestion
Add docs on how to deploy with GH pages!
Deploying to GitHub pages with Bridgetown + GitHub actions + preview deployments.
First step. Let's add the
gh-pages
packages to make deploys easier.yarn add -D gh-pages
build
command in your package.json"scripts"
key that looks like this:base_url
. I know Bridgetown deprecated thebase_url
options, but I really liked it. Modifyconfig/initializers.rb
to look like this:.env
or.envrc
at the root of your project so you can simulate "base_path" deployments.esbuild.config.js
Deploying from GitHub Actions
This gives your GitHub actions permissions to write to the
gh-pages
branch.Settings -> Pages
tab.https://github.com/{username}/{repo}/settings/pages
Yours should look something like this where
Source
isDeploy from a branch
. And thebranch
should be set togh-pages
..github/workflows/deploy-site.yml
Here's the contents:
I know this was a lot, but this was me dumping what I did to deploy my last 3/4 sites with GH Pages. Sorry if it didn't make sense.