Skip to content

Instantly share code, notes, and snippets.

@knsh14
Created September 13, 2019 17:14
Show Gist options
  • Save knsh14/83173e4fb759b0f833124758b4d65f56 to your computer and use it in GitHub Desktop.
Save knsh14/83173e4fb759b0f833124758b4d65f56 to your computer and use it in GitHub Desktop.
name: Publish hugo blog
on:
push:
branches:
- master
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.12
uses: actions/setup-go@v1
with:
go-version: 1.12
id: go
- name: Check out code into the Go module directory
uses: actions/checkout@v1
- name: install hugo
run: |
go get -u github.com/gohugoio/hugo
- name: setup public repo
run: |
git clone --depth 1 https://USERNAME:${{ secrets.MY_GITHUB_ACCESS_TOKEN }}@github.com/USERNAME/USERNAME.github.io.git public
- name: Build
run: |
export PATH=$PATH:`go env GOPATH`/bin
git submodule init
git submodule update
hugo
- name: Push
run: |
export MSG=`git log --format=%B -n 1 HEAD`
cd public
git config --local user.name "NAME"
git config --local user.email "EMAIL@gmail.com"
git add .
git commit -m "${MSG}"
git push origin master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment