-
Notifications
You must be signed in to change notification settings - Fork 0
53 lines (46 loc) · 1.64 KB
/
build.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
51
52
53
name: Hugo Blog CI
on:
push:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: 1. Checkout Repo
uses: actions/checkout@v2
with:
submodules: true
fetch-depth: 0
- name: 2. Read Hugo Verion
id: hugo-version
run: |
HUGO_VERSION=$(cat "data/meta/version.yaml" | grep hugo | grep -v '#' | awk '{print $2}' | sed 's/%2f.*$//g' | sed 's/v//g')
echo "::set-output name=HUGO_VERSION::${HUGO_VERSION}"
- name: 3. Setup Hugo
uses: peaceiris/actions-hugo@v2
with:
hugo-version: '${{ steps.hugo-version.outputs.HUGO_VERSION }}'
extended: true
- name: 4. Set Timezone & Generate Public Files
# 设置时区为 UTC+8 否则生成网站的时间可能是世界协调时
run: |
sudo timedatectl set-timezone Asia/Shanghai
hugo --minify
- name: 5. Copy Dist Github Action Workflow File
run: |
mkdir -p public/.github/workflows/
cp .github/second_action/dist.yml public/.github/workflows/dist.yml
ls -a public
- name: 6. Distribution to Github Pages
uses: peaceiris/actions-gh-pages@v3
with:
deploy_key: ${{ secrets.ACTIONS_DEPLOY_KEY }}
external_repository: ${{ secrets.ACTIONS_DEPLOY_REPO }}
publish_branch: main
publish_dir: ./public
exclude_assets: ''
cname: ${{ secrets.ACTIONS_DEPLOY_CNAME }}
commit_message: ${{ github.event.head_commit.message }}
user_name: 'github-actions[bot]'
user_email: 'github-actions[bot]@users.noreply.github.com'