ワークフロー
name: github pages
on:
push:
branches: master
jobs:
deploy:
name: Build Hugo Site
runs-on: ubuntu-18.04
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 eqs.github.io
uses: actions/checkout@v2
with:
repository: eqs/eqs.github.io
ref: master
path: gh-pages
submodules: true
- 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 "
[email protected]"
git config --local user.name "GitHub Action"
git add -A .
if git diff-index --quiet HEAD --; then
echo "No changes..."
else
msg="Rebuilding site `date`"
if [ $# -eq 1 ]
then msg="$1"
fi
git commit -m "[CI] build hugo static site $msg"
fi
- name: Push to the repository
uses: cpina/
[email protected]
env:
API_TOKEN_GITHUB: ${{ secrets.API_TOKEN_GITHUB }}
with:
source-directory: 'gh-pages'
destination-github-username: 'eqs'
destination-repository-name: 'eqs.github.io'
25/28