HUGO+GitHub Action deploy your own Blog
Prerequisites
- Install Hugo (Extended version) in macos
|
|
- Git installed
- GitHub account
Step 1: Create a New Hugo Site
|
|
Step 2: Add a Theme
Choose and install a Hugo theme in https://themes.gohugo.io/. For example, using stack theme:
To use the latest version, you can clone the repository to themes/hugo-theme-stack
by running the following command in the root directory of your Hugo site:
|
|
If you are already using Git for your site, you can add the theme as a submodule by running the following command in the root directory of your Hugo site:
|
|
Step 3: Configure Your Site
Create or modify hugo.toml/hugo.yaml with basic settings,for here, i just copy and paste the example hugo.yaml from exampleSite included in the theme. you can also transform between .yaml file and .toml file in following website. https://transform.tools/toml-to-yaml/.
Step 4: Create Content
HUGO primarily support Markdown and HTML file for content creation you can also generate a default post in command line.
|
|
Step 5: Setup GitHub Actions
Create .github/workflows/deploy.yml in your repository:
|
|
Step 6: Deploy
- Push your code to GitHub repository
- Enable GitHub Pages in repository settings
- Set the source to GitHub Actions
|
|
Your blog should now be accessible at https://yourusername.github.io/
Important Notes
- Make sure your repository name follows the format: username.github.io
- Wait a few minutes after pushing for GitHub Actions to complete the deployment
- Check the Actions tab in your GitHub repository for deployment status