generated from GitHubTemplates/github-repository-template
-
-
Notifications
You must be signed in to change notification settings - Fork 0
51 lines (48 loc) · 1.43 KB
/
main.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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
name: 'Hugo Publish'
on:
push:
branches:
- master
workflow_dispatch:
# Inputs the workflow accepts.
inputs:
name:
# Friendly description to be shown in the UI instead of 'name'
description: 'Who are you?'
# Default value if no value is explicitly provided
default: 'BruceMaa'
# Input has to be provided for the workflow to run
required: true
jobs:
publish-docs-site:
name: publish docs site
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v2
- name: remove docs
run: |
if [ -d "docs" ]; then
rm -rf docs
fi
- name: setup
id: vars
run: echo "::set-output name=commit_msg::$(git log -1 --pretty=%B)"
- name: hugo mod get
uses: jakejarvis/hugo-build-action@v0.80.0
with:
args: mod get -u
- name: hugo build
uses: jakejarvis/hugo-build-action@v0.80.0
with:
args: --gc --minify --cleanDestinationDir -d docs
- name: publish docs
run: |
git config user.name "${GITHUB_ACTOR}"
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
if [ "`git status -s`" ]
then
git add -A
git commit -am "Auto publish: ${{ steps.vars.outputs.commit_msg }} with $GITHUB_WORKFLOW on $GITHUB_RUN_NUMBER"
fi
git push