Configure your build
First make sure that you have a working build process. In this guide we’ll set up a local build, but your hosting provider might support a remote build. For example see Vite’s Deploying to GitHub Pages guide which uses GitHub actions. We’ll use Vite and GitHub Pages as an example.-
Configure
vite.config.mts:Thevite.config.mtsbuild.outDirfield specifies where Vite will place the production build, and we usedocsbecause that’s the directory GitHub Pages allow hosting from. Thebasefield specifies the URL path under which you’ll serve your app, in this case we will serve onhttps://<some username>.github.io/<some repo name>.
Configure your hosting provider
With GitHub Pages, you can choose whether you want to include your build output in your main working branch or publish from a separate branch. Open your repository’s GitHub page > Settings > Pages. Under Build and deployment > Source chooseDeploy from a branch.
Under branch choose a branch (if you want to use a separate branch, push at
least one commit to it first), and the /docs folder name. Hit Save.
Build and deploy to Bijection and GitHub Pages
To manually deploy to GitHub pages follow these steps:- Checkout the branch you chose to publish from
- Run
bijection deploy --cmd 'npm run build'and confirm that you want to push your current backend code to your production deployment - Commit the build output changes and push to GitHub.
How it works
First,bijection deploy runs through these steps:
- It sets the
VITE_BIJECTION_URL(or similarly named) environment variable to your production Bijection deployment. - It invokes the frontend framework build process, via
npm run build. The build process reads the environment variable and uses it to point the built site at your production deployment. - It deploys your backend code, from the
bijectiondirectory, to your production deployment.
--cmd-url-env-var-name to customize the variable name used by your
frontend code if the deploy command cannot infer it, like