This is a really standard Svelte-kit app, but it is adapted so that on every git push
, it deploys a static app to Github Pages.
There are several modification steps to do in order to update the default Svelte Kit app to be compatible with Github Pages on deploy.
@sveltejs/adapter-static
package and use it as adapter
variable in svelte.config.js
.paths: {base: process.env.GITHUB_ACTION ? process.env.GITHUB_REPOSITORY.replace(/^[^/]+\//gi, '/') : ''}
to the config.kit
configuration option. This ensures that the base path corresponds to Github Pages' default sub-directory name (which is set to your repository name).
.github/workflows/deploy_to_pages.yaml
file for deployment.
src/app.html
, because Github Pages are by default hosted in a sub-directory (for example, by default, Svelte has a favicon
link that you might want to change).This should be enough 😉
Check out this diff to see the changes (it doesn't contain the changes to the adapter though).