Repository navigation
64 lines (53 loc) · 1.65 KB
/
Copy pathsync-pages.yml
File metadata and controls
64 lines (53 loc) · 1.65 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
62
63
64
name: Sync Pages Deployment
on:
push:
branches:
- main
paths:
- 'docs/**'
- '.github/pages-template/**'
- '.github/scripts/**'
- '.github/workflows/sync-pages.yml'
workflow_dispatch:
permissions:
contents: write
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout main branch
uses: actions/checkout@v4
- name: Set up Hugo
uses: peaceiris/actions-hugo@v3
with:
hugo-version: 'latest'
extended: true
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Install Python dependencies
run: pip install pyyaml
- name: Create Hugo Working Directory
run: |
mkdir -p hugo-build/content hugo-build/static hugo-build/themes
cp .github/pages-template/hugo.toml hugo-build/
- name: Clone Relearn Theme
run: |
git clone --depth 1 https://github.com/McShelby/hugo-theme-relearn.git hugo-build/themes/hugo-theme-relearn
- name: Run sync pages script (generates Hugo content & static)
run: |
python .github/scripts/sync_pages.py docs hugo-build
- name: Build Hugo Site
run: |
cd hugo-build
hugo --minify
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_branch: GH_Pages
publish_dir: hugo-build/public
force_orphan: false
user_name: 'github-actions[bot]'
user_email: 'github-actions[bot]@users.noreply.github.com'