Skip to content

Commit 4eba4d9

Browse files
committed
added gh actions for deployment
1 parent 5881f28 commit 4eba4d9

2 files changed

Lines changed: 145 additions & 0 deletions

File tree

.github/DEPLOYMENT.md

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# GitHub Pages Deployment Setup
2+
3+
This repository uses GitHub Actions to automatically build and deploy the Hugo site to GitHub Pages.
4+
5+
## Setup Instructions
6+
7+
To enable automatic deployment, you need to configure GitHub Pages in your repository settings:
8+
9+
### 1. Enable GitHub Pages
10+
11+
1. Go to your repository on GitHub: `https://github.com/aeshell/aeshell.github.com`
12+
2. Click on **Settings** (top menu)
13+
3. In the left sidebar, click on **Pages** (under "Code and automation")
14+
4. Under **Build and deployment**:
15+
- **Source**: Select "GitHub Actions"
16+
- This allows the workflow to deploy to GitHub Pages
17+
18+
### 2. Trigger Deployment
19+
20+
The workflow will automatically run when:
21+
- You push commits to the `main` or `web` branch
22+
- You manually trigger it from the Actions tab
23+
24+
You can also manually trigger the workflow:
25+
1. Go to the **Actions** tab in your repository
26+
2. Click on "Deploy Hugo site to Pages" workflow
27+
3. Click **Run workflow** button
28+
29+
### 3. View Your Site
30+
31+
After the workflow completes successfully:
32+
- Your site will be available at: `https://aeshell.github.io/` (or your custom domain if configured)
33+
- You can find the URL in the workflow run under the "deploy" job
34+
35+
## Workflow Details
36+
37+
The workflow (`.github/workflows/hugo.yml`):
38+
- Uses Hugo v0.152.2 Extended
39+
- Installs Go 1.25 for Hugo modules
40+
- Builds the site with minification and garbage collection
41+
- Deploys to GitHub Pages using the official GitHub Actions
42+
43+
## Custom Domain (Optional)
44+
45+
If you want to use a custom domain:
46+
1. Add a `CNAME` file to the `static/` directory with your domain name
47+
2. Configure your DNS provider to point to GitHub Pages
48+
3. Enable HTTPS in repository settings > Pages
49+
50+
## Troubleshooting
51+
52+
If the deployment fails:
53+
1. Check the Actions tab for error logs
54+
2. Ensure GitHub Pages is enabled with "GitHub Actions" as the source
55+
3. Verify the repository has Pages deployment permissions enabled

.github/workflows/hugo.yml

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
# GitHub Actions workflow to build and deploy Hugo site to GitHub Pages
2+
name: Deploy Hugo site to Pages
3+
4+
on:
5+
# Runs on pushes targeting the default branch
6+
push:
7+
branches:
8+
- main
9+
- web
10+
11+
# Allows you to run this workflow manually from the Actions tab
12+
workflow_dispatch:
13+
14+
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
15+
permissions:
16+
contents: read
17+
pages: write
18+
id-token: write
19+
20+
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
21+
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
22+
concurrency:
23+
group: "pages"
24+
cancel-in-progress: false
25+
26+
# Default to bash
27+
defaults:
28+
run:
29+
shell: bash
30+
31+
jobs:
32+
# Build job
33+
build:
34+
runs-on: ubuntu-latest
35+
env:
36+
HUGO_VERSION: 0.152.2
37+
steps:
38+
- name: Checkout repository
39+
uses: actions/checkout@v4
40+
with:
41+
submodules: recursive
42+
fetch-depth: 0
43+
44+
- name: Setup Go
45+
uses: actions/setup-go@v5
46+
with:
47+
go-version: '1.25'
48+
49+
- name: Install Hugo CLI
50+
run: |
51+
wget -O ${{ runner.temp }}/hugo.deb https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-amd64.deb \
52+
&& sudo dpkg -i ${{ runner.temp }}/hugo.deb
53+
54+
- name: Install Dart Sass
55+
run: sudo snap install dart-sass
56+
57+
- name: Setup Pages
58+
id: pages
59+
uses: actions/configure-pages@v4
60+
61+
- name: Install Node.js dependencies
62+
run: "[[ -f package-lock.json || -f npm-shrinkwrap.json ]] && npm ci || true"
63+
64+
- name: Build with Hugo
65+
env:
66+
# For maximum backward compatibility with Hugo modules
67+
HUGO_ENVIRONMENT: production
68+
HUGO_ENV: production
69+
run: |
70+
hugo \
71+
--gc \
72+
--minify \
73+
--baseURL "${{ steps.pages.outputs.base_url }}/"
74+
75+
- name: Upload artifact
76+
uses: actions/upload-pages-artifact@v3
77+
with:
78+
path: ./public
79+
80+
# Deployment job
81+
deploy:
82+
environment:
83+
name: github-pages
84+
url: ${{ steps.deployment.outputs.page_url }}
85+
runs-on: ubuntu-latest
86+
needs: build
87+
steps:
88+
- name: Deploy to GitHub Pages
89+
id: deployment
90+
uses: actions/deploy-pages@v4

0 commit comments

Comments
 (0)