Skip to content

Publish site

Publish site #306

Workflow file for this run

name: Publish site
on:
schedule:
- cron: '46 09 * * *'
push:
branches: [ main ]
jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0 # Fetch all history for .GitInfo and .Lastmod
- name: Build the site
run: ./build.sh
- name: Push dist to github pages branch
shell: bash
run: |
git config --global user.name "Rouke Broersma"
git config --global user.email "3595932+rouke-broersma@users.noreply.github.com"
GIT_COMMIT=$(git rev-parse HEAD)
git fetch
git checkout gh-pages
sudo chown -R $USER:$USER .
ls --hide=dist | xargs sudo rm -r
shopt -s dotglob
mv dist/* .
rmdir dist
git add .
if [[ -n $(git status -s) ]]; then
echo ""
echo "Changes found, deploying"
git commit -am "Update to $GIT_COMMIT"
git push -u origin gh-pages
else
echo ""
echo "There were no changes, skipping.."
fi