Deploy your Thulite Site to GitHub Pages
You can use GitHub Pages to host a Thulite website directly from a repository on GitHub.com.
How to deploy
You can deploy a Thulite site to GitHub Pages by using GitHub Actions to automatically build and deploy your site. To do this, your source code must be hosted on GitHub.
Follow the instructions below to deploy your Thulite site to GitHub pages.
-
Create a new file in your project at
.github/workflows/deploy.yml
and paste in the YAML below.deploy.yml # Sample workflow for building and deploying a Thulite site to GitHub Pagesname: Deploy Thulite site to Pageson:# Runs on pushes targeting the default branchpush:branches:- main# Allows you to run this workflow manually from the Actions tabworkflow_dispatch:# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pagespermissions:contents: readpages: writeid-token: write# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.concurrency:group: "pages"cancel-in-progress: false# Default to bashdefaults:run:shell: bashjobs:# Build jobbuild:runs-on: ubuntu-latestenv:HUGO_VERSION: 0.126.0steps:- name: Install Hugo CLIrun: |wget -O ${{ runner.temp }}/hugo.deb https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-amd64.deb \&& sudo dpkg -i ${{ runner.temp }}/hugo.deb- name: Install Dart Sassrun: sudo snap install dart-sass- name: Checkoutuses: actions/checkout@v4with:submodules: recursivefetch-depth: 0- name: Setup Node.jsuses: actions/setup-node@v4with:node-version: '20'cache: 'npm'- name: Setup Pagesid: pagesuses: actions/configure-pages@v4- name: Install dependenciesrun: "[[ -f package-lock.json || -f npm-shrinkwrap.json ]] && npm ci || true"- name: Build production websiteenv:# For maximum backward compatibility with Hugo modulesHUGO_ENVIRONMENT: productionHUGO_ENV: productionTZ: America/Los_Angelesrun: |npm run build \-- \--baseURL "${{ steps.pages.outputs.base_url }}/"- name: Upload artifactuses: actions/upload-pages-artifact@v3with:path: ./public# Deployment jobdeploy:environment:name: github-pagesurl: ${{ steps.deployment.outputs.page_url }}runs-on: ubuntu-latestneeds: buildsteps:- name: Deploy to GitHub Pagesid: deploymentuses: actions/deploy-pages@v4 -
On GitHub, go to your repository’s Settings tab and find the Pages section of the settings.
-
Choose GitHub Actions as the Source of your site.
-
Commit the new workflow file and push it to GitHub.
-
Copy the Your site is published at URL and paste it as
baseurl
in./config/production/hugo.toml
. -
Push the changes to GitHub and wait for the action to finish succesfully (after approximately 30 seconds).
That’s it. After a minute or so, you site is avaliable at the Your site is published at URL. When you push changes to your Thulite project’s repository, the GitHub Action will automatically deploy them for you.