Deploying your site
Once you have built your site, you need to deploy it somewhere. It should be possible to deploy to any static site provider that supports a Go runtime, and we can provide some guides here.
Guides on this page:
Cloudflare Pages
Cloudflare Pages offers an easy way to deploy your static sites, with preview deployments and basic analytics out of the box.
- Push your project to GitHub or GitLab
- Login to the Cloudflare dashboard and select your account
- Select Workers & Pages > Create > Pages > Connect to Git
Here you will be prompted to sign in with your Git provider. Once connected, select the repository that contains your static siteproject and click Begin Setup.
Once connected, it is as simple as selecting your build command to build your project and site (e.g. make build
or go run main.go
), and the build output directory (which by default is /dist
).
From here you can deploy your site everytime you commit to your main branch, as well as get automatic preview URLs when pushing up new branches and pull requests. You can read their docs for more information.
GitHub Pages
GitHub Pages allows you to host your static site straight from GitHub. This is convenient especially if you are already using GitHub to put your project. We can leverage GitHub Actions to build and deploy your site automatically.
-
Follow their guide on how to create a GitHub pages site, either with a new or existing repo.
-
Once created, follow their guide to set the publishing source to GitHub Actions.
-
When doing this, GitHub will suggest a workflow to build and publish your site. You can also use this GitHub workflow as a template to build and deploy with Tailwind also.