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
41
42
43
44
45
46
47
48
49
50
51
52
|
name: Deploy
env:
HUGO_VERSION: '0.104.3'
HUGO_ENV: "production"
HUGO_BASEURL: "https://my-website/"
on:
push:
branches:
- main
pull_request:
branches:
- main
- 'releases/**'
- 'feature/**'
schedule:
- cron: "0 10 * * *"
jobs:
deploy:
runs-on: ubuntu-22.04
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
steps:
- name: Setup Hugo
run: |
curl -L https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_${HUGO_VERSION}_linux-amd64.tar.gz | tar -xz;
chmod a+x hugo;
rm -f LICENSE README.md
mv hugo /usr/local/bin
- uses: actions/checkout@v3
with:
ref: ${{ github.head_ref }}
- name: Build
run: |
hugo --gc
- name: Check for modified files
id: git-check
run: echo "modified=$(if [ -n "$(git status --porcelain)" ]; then echo "true"; else echo "false"; fi)" >> $GITHUB_OUTPUT
- name: Update changes in GitHub repository
if: steps.git-check.outputs.modified == 'true'
run: |
git config user.name github-actions
git config user.email github-actions@github.com
git add .
git commit -m 'chore(deploy): update website'
git push
|