-
Notifications
You must be signed in to change notification settings - Fork 0
40 lines (34 loc) · 926 Bytes
/
build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
---
name: build site
on:
push:
branches:
- master
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout codebase
uses: actions/checkout@v4
- name: Setup Hugo
uses: peaceiris/actions-hugo@v2
with:
hugo-version: '0.119.0'
extended: true
- name: Delete public/
run: rm -rf public/
- name: Build site
run: hugo --gc --minify --enableGitInfo
- name: Deploy site to deploy branch
run: |
git worktree add deploy
git config user.name "Deploy from CI"
git config user.email ""
cd deploy
# Delete the ref to avoid keeping history.
git update-ref -d refs/heads/deploy
rm -rf *
mv ../public/* .
git add .
git commit -m "Deploy $GITHUB_SHA to deploy"
git push --force --set-upstream origin deploy