Skip to content

Commit de7c4c6

Browse files
2 parents 451638b + f759e93 commit de7c4c6

File tree

1 file changed

+51
-0
lines changed

1 file changed

+51
-0
lines changed

.github/workflows/main.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: Deploy Portfolio + Hugo Blog
2+
3+
on:
4+
push:
5+
branches: [main]
6+
7+
jobs:
8+
deploy:
9+
runs-on: ubuntu-latest
10+
11+
permissions:
12+
contents: write
13+
pages: write
14+
15+
steps:
16+
# 1️⃣ Checkout repo
17+
- name: Checkout repository
18+
uses: actions/checkout@v4
19+
with:
20+
fetch-depth: 0
21+
submodules: true
22+
23+
# 2️⃣ Build Hugo blog
24+
- name: Setup Hugo
25+
uses: peaceiris/actions-hugo@v2
26+
with:
27+
hugo-version: "latest"
28+
extended: true
29+
30+
- name: Build Hugo site
31+
run: |
32+
hugo --source ./blog --destination ./blog-output --minify --baseURL "https://aravind-govindhasamy.github.io/my-blog/"
33+
34+
# 3️⃣ Prepare combined deployment
35+
- name: Prepare gh-pages directory
36+
run: |
37+
mkdir gh-pages-temp
38+
cp -r !(.git|blog|blog-output|.github|README.md) gh-pages-temp/ # copy portfolio files
39+
mkdir -p gh-pages-temp/my-blog
40+
cp -r blog-output/* gh-pages-temp/my-blog/ # copy Hugo output
41+
42+
# 4️⃣ Deploy to GitHub Pages
43+
- name: Deploy to GitHub Pages
44+
uses: peaceiris/actions-gh-pages@v3
45+
with:
46+
github_token: ${{ secrets.GITHUB_TOKEN }}
47+
publish_dir: ./gh-pages-temp
48+
publish_branch: gh-pages
49+
force_orphan: true
50+
user_name: github-actions
51+
user_email: github-actions@github.com

0 commit comments

Comments
 (0)