1
mirror of https://github.com/jakejarvis/jarv.is.git synced 2025-04-27 15:56:23 -04:00
jarv.is/.github/workflows/gh-pages.yml

43 lines
1.4 KiB
YAML

name: GitHub Pages
on:
push:
branches:
- master
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
with:
fetch-depth: 1
lfs: false
# pull from custom Hugo Extended image with opinionated changes
# Docker hub: https://hub.docker.com/r/jakejarvis/hugo-custom
# base Dockerfile source: https://go.jarv.is/hugo-dockerfile
- name: Build Hugo
uses: docker://jakejarvis/hugo-custom:latest
with:
args: --gc --cleanDestinationDir
# native git commands for speed and simplicity, and because this
# setup is a weird edge case not worth making an action for.
- name: Push to jakejarvis.github.io
shell: bash
run: |
# copy Hugo output to somewhere we have permissions
mkdir gh-pages
cp -r public/* gh-pages
cd gh-pages
# CNAME file for GitHub Pages custom domain
echo "jarv.is" > CNAME
# set up git
git init
git config user.name "Jake Jarvis"
git config user.email "jakejarvis@users.noreply.github.com"
# deploy folder to external *.github.io repository
git remote add target https://${{ secrets.GITHUB_ACCESS_TOKEN }}@github.com/jakejarvis/jakejarvis.github.io.git
git add -A
git commit -m "GitHub Pages deploy from $GITHUB_REPOSITORY@$GITHUB_SHA"
git push --force target master