2022-12-13 19:14:48 +00:00
|
|
|
name: Build website
|
|
|
|
|
|
|
|
on:
|
2023-04-14 04:40:13 +00:00
|
|
|
- push
|
|
|
|
- pull_request
|
2022-12-13 19:14:48 +00:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
deploy:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2024-05-03 16:38:23 +00:00
|
|
|
- uses: actions/checkout@v4
|
2022-12-13 19:14:48 +00:00
|
|
|
with:
|
|
|
|
submodules: true
|
|
|
|
fetch-depth: 0
|
|
|
|
|
|
|
|
- name: Setup Hugo
|
2024-05-03 16:38:23 +00:00
|
|
|
uses: peaceiris/actions-hugo@v3
|
2022-12-13 19:14:48 +00:00
|
|
|
with:
|
|
|
|
hugo-version: 'latest'
|
|
|
|
extended: true
|
|
|
|
|
2023-04-14 04:40:13 +00:00
|
|
|
- name: Set branch name
|
|
|
|
id: branch
|
2023-07-09 21:08:14 +00:00
|
|
|
run: echo "BRANCH_NAME=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> "$GITHUB_ENV"
|
2023-04-14 04:40:13 +00:00
|
|
|
|
2023-04-14 05:23:24 +00:00
|
|
|
- name: Fix base URL
|
2023-07-09 20:48:51 +00:00
|
|
|
if: env.BRANCH_NAME != 'master' && github.repository_owner == 'Rosettea'
|
|
|
|
run: sed -i "s%baseURL = 'https://rosettea.github.io/Hilbish/'%baseURL = 'https://rosettea.github.io/Hilbish/versions/${{ env.BRANCH_NAME }}'%" website/config.toml
|
2023-04-14 05:23:24 +00:00
|
|
|
|
|
|
|
- name: Build
|
|
|
|
run: 'cd website && hugo --minify'
|
|
|
|
|
2023-04-14 04:40:13 +00:00
|
|
|
- name: Deploy
|
2023-07-09 20:48:51 +00:00
|
|
|
if: env.BRANCH_NAME == 'master' && github.repository_owner == 'Rosettea'
|
2024-05-03 16:38:23 +00:00
|
|
|
uses: peaceiris/actions-gh-pages@v4
|
2023-04-14 04:40:13 +00:00
|
|
|
with:
|
|
|
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
publish_dir: ./website/public
|
|
|
|
keep_files: true
|
2022-12-13 19:14:48 +00:00
|
|
|
- name: Deploy
|
2023-07-09 20:48:51 +00:00
|
|
|
if: env.BRANCH_NAME != 'master' && github.repository_owner == 'Rosettea'
|
2024-05-03 16:38:23 +00:00
|
|
|
uses: peaceiris/actions-gh-pages@v4
|
2022-12-13 19:14:48 +00:00
|
|
|
with:
|
|
|
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
publish_dir: ./website/public
|
2023-07-09 20:48:51 +00:00
|
|
|
destination_dir: versions/${{ env.BRANCH_NAME }}
|
2023-04-14 04:40:13 +00:00
|
|
|
keep_files: true
|