CZON

Guide to Deploying CZON Static Sites to GitHub Pages

Deployment

👤 Developers using CZON to generate static sites who wish to deploy to GitHub Pages, particularly those needing multilingual support and automated deployment.
This article details how to deploy CZON-generated multilingual static sites to GitHub Pages via GitHub CLI. First, install and log in to GitHub CLI, ensuring repo permissions. Then run the command npx czon@latest config github, which guides users through a series of steps: checking permissions, initializing a Git repository, configuring the remote repository, enabling GitHub Pages and setting it to workflow type, creating or updating the Workflow file, committing and pushing changes, and finally obtaining the Pages URL. The entire process is automated, simplifying deployment.
  • ✨ Install and log in to GitHub CLI, ensuring repo permissions
  • ✨ Run the npx czon@latest config github command to automate deployment
  • ✨ Check and configure the Git repository and remote repository
  • ✨ Enable GitHub Pages and set it to workflow type
  • ✨ Create or update the Pages Workflow file
280 words · ~2 min read
  • GitHub Pages
  • CZON
  • Static Site
  • Deployment Guide
  • GitHub CLI
  • Multilingual
  • Automated Deployment

Table of Contents

Deploy to GitHub Pages

Deploy to GitHub Pages

This guide explains how to deploy a multilingual static site generated by CZON to GitHub Pages using GitHub CLI.

First, install the GitHub CLI tool (if not already installed) and ensure you are logged in (if not already logged in):

$ gh --version # Check the version to ensure successful installation

Ensure you are logged in and have repo access permissions to the target repository:

$ gh auth login -s repo # Log in to your GitHub account; you will be prompted to log in via browser or use a token
$ gh auth status # Check login status to ensure you are successfully logged in and have repo access permissions to the target repository

After that, simply run the following command and follow the prompts:

$ npx czon@latest config github

This command will guide you through the following steps:

  1. Check if gh permissions include repo. If not, you will be prompted to log in again and add repo permissions.
  2. If the local directory is not a Git repository, you will be prompted to initialize a new Git repository.
  3. Check the remote Git repository settings of the local directory to see if there is a GitHub remote repository. If there is no GitHub remote repository, you will be prompted to create a new remote repository and add it as the remote origin. If origin already exists but is not a GitHub repository, you will be prompted to add a new GitHub remote repository as upstream.
  4. Check if GitHub Pages is enabled and is of the workflow type. If not, enable it via the API gh api and correct it to deploy from Actions. Also, set up the CNAME (if you have a custom domain).
  5. Check the GitHub Workflow file. If it has not been created, create the Pages Workflow file; if it already exists but is not the latest version, you will be prompted to update the Workflow file.
  6. Commit the Workflow file and push the changes to the remote repository.
  7. Prompt you to visit the GitHub Pages website URL, retrieving the latest Pages URL via gh api.