Skip to content

v4.8.0

v4.8.0 #241

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 }}