Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
matt-harrison.com2/.github/workflows/build.yml
View runs Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
55 lines (45 sloc)
1.26 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: build | |
on: | |
push: | |
branches: [master] | |
jobs: | |
build: | |
name: Build Hugo Site | |
runs-on: ubuntu-latest | |
steps: | |
- name: Install Hugo | |
env: | |
HUGO_VERSION: 0.74.1 | |
run: | | |
mkdir ~/hugo | |
cd ~/hugo | |
curl -L "https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_${HUGO_VERSION}_Linux-64bit.tar.gz" --output hugo.tar.gz | |
tar -xvzf hugo.tar.gz | |
sudo mv hugo /usr/local/bin | |
- name: Checkout master branch | |
uses: actions/checkout@v2 | |
with: | |
ref: master | |
path: main | |
submodules: true | |
- name: Checkout gh-pages branch | |
uses: actions/checkout@v2 | |
with: | |
ref: gh-pages | |
path: gh-pages | |
- name: Hugo Build | |
run: cd main && hugo | |
- name: Copy files | |
run: cp -rf main/public/* gh-pages/ | |
- name: Commit changes | |
run: | | |
cd gh-pages | |
git config --local user.email "actions@github.com" | |
git config --local user.name "GitHub Action" | |
git add -A . | |
if git diff-index --quiet HEAD --; then | |
echo "No changes..." | |
else | |
git commit -m "[CI] build hugo static site" | |
git push | |
fi | |