32 lines (27 loc) · 907 Bytes
/
publish.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
name: Publish Content
on:
push:
branches:
- develop
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: |
git config --global user.email "${GITHUB_EMAIL}"
git config --global user.name "${GITHUB_USER}"
git fetch --unshallow
rm -rf public
echo "checkout to master as worktree"
git worktree prune && git worktree add -B master public origin/master
echo "generate static content in public"
docker run --rm -v $(pwd):/src -v $(pwd)/public:/src/public peaceiris/hugo:v0.89.3-full -b 'https://l1990790120.github.io/' --gc --minify
echo "push public to master"
cd public
git add --all
git commit -m "Publishing to master"
git push
env:
GITHUB_EMAIL: ${{ secrets.GITHUB_EMAIL }}
GITHUB_USER: ${{ secrets.GITHUB_USER }}