-
Notifications
You must be signed in to change notification settings - Fork 152
86 lines (70 loc) · 2.36 KB
/
update-demo-page.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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
name: Update GitHub Pages
on:
release:
types: [published]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# Default to bash
defaults:
run:
shell: bash
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup Hugo
uses: peaceiris/actions-hugo@v2
with:
hugo-version: '0.125.7'
extended: true
- name: Run tests
run: ./v4/tests/exampleSite/test-theme.sh
deploy:
runs-on: ubuntu-latest
needs: test
steps:
- uses: actions/checkout@v3
- name: Setup Hugo
uses: peaceiris/actions-hugo@v2
with:
hugo-version: '0.125.7'
extended: true
- name: Create new demo site
run: |
hugo new site /tmp/demo-site
rm /tmp/demo-site/archetypes/default.md
- name: Init Hugo module
working-directory: /tmp/demo-site
run: |
hugo mod init github.com/Lednerb/bilberry-hugo-theme/exampleSite
- name: Copy exampleSite content to new site
run: cp -r ./v4/exampleSite/* /tmp/demo-site
- name: Pull theme's Hugo module
working-directory: /tmp/demo-site
run: |
hugo mod get -u
cat go.mod
- name: Adjust hugo.toml
working-directory: /tmp/demo-site
run: |
sed -i "s/baseURL = .*$/baseURL = \"https:\/\/lednerb.github.io\/bilberry-hugo-theme\/\"/" hugo.toml
version=$(grep -Po "(?<=v4\s)[^\s//]+" go.mod)
sed -i "s/creditsText = .*$/creditsText = \"Bilberry Hugo Theme $version\"/" hugo.toml
sed -i "s/creditsUrl = .*$/creditsUrl = \"https:\/\/github.com\/Lednerb\/bilberry-hugo-theme\/tree\/$version\"/" hugo.toml
- name: Build
working-directory: /tmp/demo-site
run: |
rm -rf themes/bilberry-hugo-theme
hugo --environment development
> public/.nojekyll
sed -i "s~webfonts~bilberry-hugo-theme/webfonts~g" public/theme.css
sed -i "s~/fonts~/bilberry-hugo-theme/fonts~g" public/theme.css
- name: Deploy to GitHub Pages
if: success()
uses: crazy-max/ghaction-github-pages@v3
with:
target_branch: gh-pages
build_dir: ../../../../../../../../tmp/demo-site/public
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}