Skip to content

Update ci.yaml

Update ci.yaml #21

Workflow file for this run

name: CI
on:
push:
branches: [ main ]
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Check out latest commit
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v4
name: Checkout src repo
with:
path: src
fetch-depth: 0
ref: main
submodules: recursive
- name: Setup Hugo
uses: peaceiris/actions-hugo@v2
with:
hugo-version: '0.80.0'
- name: Build
working-directory: src
run: hugo
# Checkout destination branch
- uses: actions/checkout@v4
name: Checkout dest repo
with:
path: dest
fetch-depth: 0
ref: gh-pages
# Commit and push changes
- name: Copy website built from src/public
working-directory: dest
run: |
rm -rf *
yes | cp -rf ../src/public/* .
# Commit and push changes
- name: Commit website updates
working-directory: dest
run: |
git config --global user.name github-actions
git config --global user.email github-actions@github.com
git add .
git diff-index --quiet HEAD || git commit -m "Deploy website updates with GitHub Actions: ${GITHUB_SHA}"
git push origin gh-pages