-
Notifications
You must be signed in to change notification settings - Fork 6
61 lines (47 loc) · 1.26 KB
/
main.yml
File metadata and controls
61 lines (47 loc) · 1.26 KB
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
53
54
55
56
57
58
59
60
61
name: Build & Publish
on:
workflow_dispatch:
push:
branches:
- main
# This permission is required to push changes to the deploy branch
permissions:
contents: write
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout main repo
uses: actions/checkout@v4
- name: Install dependencies
run: ./install-hugo.sh
- name: Setup Pages
id: pages
uses: actions/configure-pages@v5
- name: Build content
run: hugo --baseURL "${{ steps.pages.outputs.base_url }}/"
- name: Move public to tmp
run: |
mv public /tmp/public
- name: Checkout deploy branch
uses: actions/checkout@v4
with:
ref: deploy
- name: Remove old files
run: |
ls -A | grep -xv -e ".git" | xargs rm -rf
- name: Move public folder to repo root
run: |
mv /tmp/public/* .
rm -rf /tmp/public
- name: Configure git
run: |
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --global user.name "github-actions[bot]"
- name: Commit changes
run: |
git add .
git commit -m "Deploy"
- name: Push changes
run: |
git push origin HEAD:deploy