Skip to content

Commit fa8e637

Browse files
authored
feat(ci): update CI workflows (#1016)
1 parent a1c3e9e commit fa8e637

File tree

5 files changed

+137
-55
lines changed

5 files changed

+137
-55
lines changed

.github/workflows/ci.yml

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [ "master" ]
6+
pull_request:
7+
8+
permissions:
9+
contents: read
10+
11+
concurrency:
12+
group: ci-${{ github.ref }}
13+
cancel-in-progress: true
14+
15+
jobs:
16+
build-and-validate:
17+
runs-on: ubuntu-latest
18+
strategy:
19+
fail-fast: false
20+
matrix:
21+
hugo_version: [ "0.146.0", "0.156.0" ]
22+
hugo_env: [ production, development ]
23+
include:
24+
- hugo_env: production
25+
build_args: "--source exampleSite --gc --minify --panicOnWarning"
26+
- hugo_env: development
27+
build_args: "--source exampleSite --buildDrafts --buildFuture"
28+
env:
29+
HUGO_ENV: ${{ matrix.hugo_env }}
30+
31+
steps:
32+
- name: Checkout
33+
uses: actions/checkout@v4
34+
with:
35+
fetch-depth: 0
36+
submodules: recursive
37+
38+
- name: Setup Hugo
39+
uses: peaceiris/actions-hugo@v3
40+
with:
41+
hugo-version: ${{ matrix.hugo_version }}
42+
extended: true
43+
44+
- name: Build
45+
run: |
46+
hugo ${{ matrix.build_args }}
47+
48+
- name: Setup Ruby
49+
uses: ruby/setup-ruby@v1
50+
with:
51+
ruby-version: "3.3"
52+
53+
- name: Install Validator
54+
run: gem install html-proofer -v 5.2.0
55+
56+
- name: Validate Output
57+
run: |
58+
htmlproofer ./exampleSite/public \
59+
--disable-external \
60+
--ignore-missing-alt \
61+
--no-enforce-https
62+
63+
ci-gate:
64+
runs-on: ubuntu-latest
65+
needs: [ build-and-validate ]
66+
if: always()
67+
steps:
68+
- run: |
69+
echo "build-and-validate result: ${{ needs.build-and-validate.result }}"
70+
if [ "${{ needs.build-and-validate.result }}" != "success" ]; then
71+
exit 1
72+
fi

.github/workflows/hugo-matrix-validate.yml

Lines changed: 0 additions & 53 deletions
This file was deleted.

.github/workflows/nightly.yml

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
name: Nightly
2+
3+
on:
4+
schedule:
5+
- cron: "0 10 * * *"
6+
workflow_dispatch:
7+
inputs:
8+
hugo_version:
9+
description: "Hugo version (e.g. 0.146.0 or latest)"
10+
required: true
11+
default: "latest"
12+
13+
permissions:
14+
contents: read
15+
16+
concurrency:
17+
group: nightly
18+
cancel-in-progress: true
19+
20+
jobs:
21+
latest-validate:
22+
runs-on: ubuntu-latest
23+
strategy:
24+
fail-fast: false
25+
matrix:
26+
hugo_env: [ production, development ]
27+
include:
28+
- hugo_env: production
29+
build_args: "--source exampleSite --gc --minify --panicOnWarning"
30+
- hugo_env: development
31+
build_args: "--source exampleSite --buildDrafts --buildFuture"
32+
env:
33+
HUGO_ENV: ${{ matrix.hugo_env }}
34+
35+
steps:
36+
- name: Checkout
37+
uses: actions/checkout@v4
38+
with:
39+
fetch-depth: 0
40+
submodules: recursive
41+
42+
- name: Setup Hugo
43+
uses: peaceiris/actions-hugo@v3
44+
with:
45+
hugo-version: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.hugo_version || 'latest' }}
46+
extended: true
47+
48+
- name: Build
49+
run: |
50+
hugo ${{ matrix.build_args }}
51+
52+
- name: Setup Ruby
53+
uses: ruby/setup-ruby@v1
54+
with:
55+
ruby-version: "3.3"
56+
57+
- name: Install Validator
58+
run: gem install html-proofer -v 5.2.0
59+
60+
- name: Validate Output
61+
run: |
62+
htmlproofer ./exampleSite/public \
63+
--disable-external \
64+
--ignore-missing-alt \
65+
--no-enforce-https

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
[![Hugo](https://img.shields.io/badge/Hugo-%5E0.128.0-ff4088?style=flat-square&logo=hugo)](https://gohugo.io/)
55
[![License](https://img.shields.io/github/license/dillonzq/LoveIt?style=flat-square)](https://github.com/dillonzq/LoveIt/blob/master/LICENSE)
66
[![Netlify Status](https://api.netlify.com/api/v1/badges/e60303f2-862c-4342-bf59-7c9adb10812e/deploy-status)](https://app.netlify.com/sites/hugo-loveit/deploys)
7-
[![Hugo build (multi-version) + HTML validate](https://github.com/dillonzq/LoveIt/actions/workflows/hugo-matrix-validate.yml/badge.svg)](https://github.com/dillonzq/LoveIt/actions/workflows/hugo-matrix-validate.yml)
87

98
English README | [简体中文说明](https://github.com/dillonzq/LoveIt/blob/master/README.zh-cn.md)
109

README.zh-cn.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
[![Hugo](https://img.shields.io/badge/Hugo-%5E0.128.0-ff4088?style=flat-square&logo=hugo)](https://gohugo.io/)
55
[![License](https://img.shields.io/github/license/dillonzq/LoveIt?style=flat-square)](https://github.com/dillonzq/LoveIt/blob/master/LICENSE)
66
[![Netlify Status](https://api.netlify.com/api/v1/badges/e60303f2-862c-4342-bf59-7c9adb10812e/deploy-status)](https://app.netlify.com/sites/hugo-loveit/deploys)
7-
[![Hugo build (multi-version) + HTML validate](https://github.com/dillonzq/LoveIt/actions/workflows/hugo-matrix-validate.yml/badge.svg)](https://github.com/dillonzq/LoveIt/actions/workflows/hugo-matrix-validate.yml)
87

98
[English README](https://github.com/dillonzq/LoveIt/blob/master/README.md) | 简体中文说明
109

0 commit comments

Comments
 (0)