Skip to content

v4.2.0

v4.2.0 #223

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.109.0'
extended: true
- name: Run tests
run: ./testing/testing-example-site/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.109.0'
extended: true
- name: Create new demo site
run: hugo new site /tmp/demo-site
- name: Copy exampleSite content to new site
run: cp -r ./v4/exampleSite/* /tmp/demo-site
- name: Init Hugo module
working-directory: /tmp/demo-site
run: |
hugo mod init github.com/Lednerb/bilberry-hugo-theme/exampleSite
hugo mod get
cat go.mod
- name: Adjust config.yml
working-directory: /tmp/demo-site
run: |
sed -i "s/baseURL = .*$/baseURL = \"https:\/\/lednerb.github.io\/bilberry-hugo-theme\/\"/" config.toml
version=$(grep -Po "(?<=v4\s)[^\s//]+" go.mod)
sed -i "s/creditsText = .*$/creditsText = \"Bilberry Hugo Theme $version\"/" config.toml
sed -i "s/creditsUrl = .*$/creditsUrl = \"https:\/\/github.com\/Lednerb\/bilberry-hugo-theme\/tree\/$version\"/" config.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 }}