-
Notifications
You must be signed in to change notification settings - Fork 6
154 lines (135 loc) · 5.93 KB
/
gh-pages.yaml
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
name: GitHub Pages
on:
push:
branches:
- '*'
pull_request:
branches:
- '*'
paths:
- website/**
- '!website/nginx/**'
- '!website/.gitignore'
- .editorconfig
- .github/workflows/gh-pages.yaml
- .github/workflows/gh-pages-deploy.yaml
types:
- opened
- synchronize
- reopened
jobs:
lint:
name: (${{ github.workflow }}) Lints
# https://github.com/actions/runner-images/blob/main/images/macos/macos-14-Readme.md
runs-on: macos-14
env:
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Checkout
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
with:
submodules: true
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '20.17.0'
# Cache '.npm' to speed up clean-install when package-lock.json is updated.
# Loosened up the restore-keys a bit, as it doesn't have to match the contents of package-lock.json exactly.
- name: Cache .npm
id: cache-npm
uses: actions/cache@v3
with:
path: ~/.npm
# If cache is corrupted, increment prefixed number.
key: 1-${{ runner.os }}-website-npm-${{ hashFiles('website/package-lock.json') }}
restore-keys: |
1-${{ runner.os }}-website-npm-
# If package-lock.json matches, node_modules will also match.
# So, cache node_modules directly to skip install step.
- name: Cache node_modules
id: cache-node-modules
uses: actions/cache@v3
with:
path: website/node_modules
# If cache is corrupted, increment prefixed number.
key: 1-${{ runner.os }}-website-node-modules-${{ hashFiles('website/package-lock.json') }}
- name: Install dependencies
if: steps.cache-node-modules.outputs.cache-hit != 'true'
run: |
npm clean-install --prefix website 2>&1 | tee /dev/stderr | test $(grep --count -E '(Error:|gyp ERR!)') -le 0
- name: Set up reviewdog
uses: reviewdog/action-setup@v1
with:
reviewdog_version: latest
# In the case of reviewdog, the result of the lint error is determined based on the current directory.
# So, use cd instead of --prefix to move the current directory.
- name: Lint (textlint)
run: |
cd website && npm run -s lint:text -- -f checkstyle | reviewdog -tee -fail-on-error -reporter=github-check -filter-mode=nofilter -f=checkstyle -name="textlint (GitHub Pages)"
- name: Lint (markdownlint)
if: always()
run: |
cd website && npm run -s lint:md 2>&1 | sed -e 's/^/e:/' | reviewdog -tee -fail-on-error -reporter=github-check -filter-mode=nofilter -efm="%t:%f:%l:%c %m" -efm="%t:%f:%l %m" -name="markdownlint (GitHub Pages)"
- name: Lint (ESLint)
if: always()
run: |
cd website && npm run -s lint:es -- -f eslint-formatter-rdjson | reviewdog -tee -fail-on-error -reporter=github-check -filter-mode=nofilter -f=rdjson -name="ESLint (GitHub Pages)"
- name: Lint (TypeScript)
if: always()
run: |
cd website && npm run -s lint:tsc | reviewdog -tee -fail-on-error -reporter=github-check -filter-mode=nofilter -f=tsc -name="TypeScript (GitHub Pages)"
- name: Lint (stylelint)
if: always()
run: |
cd website && npm run -s lint:css -- --no-color | reviewdog -tee -fail-on-error -reporter=github-check -filter-mode=nofilter -f=stylelint -name="stylelint (GitHub Pages)"
build:
name: (${{ github.workflow }}) Build
# https://github.com/actions/runner-images/blob/main/images/linux/Ubuntu2204-Readme.md
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
with:
submodules: true
fetch-depth: 0
# Cache '.npm' to speed up clean-install when package-lock.json is updated.
# Loosened up the restore-keys a bit, as it doesn't have to match the contents of package-lock.json exactly.
- name: Cache .npm
id: cache-npm
uses: actions/cache@v3
with:
path: ~/.npm
# If cache is corrupted, increment prefixed number.
key: 1-${{ runner.os }}-website-npm-${{ hashFiles('website/package-lock.json') }}
restore-keys: |
1-${{ runner.os }}-website-npm-
# If package-lock.json matches, node_modules will also match.
# So, cache node_modules directly to skip install step.
- name: Cache node_modules
id: cache-node-modules
uses: actions/cache@v3
with:
path: website/node_modules
# If cache is corrupted, increment prefixed number.
key: 1-${{ runner.os }}-website-node-modules-${{ hashFiles('website/package-lock.json') }}
- name: Install dependencies
if: steps.cache-node-modules.outputs.cache-hit != 'true'
run: |
npm clean-install --prefix website
- name: Build documents
run: |
npm run build --prefix website -- --out-dir build/mobile-app-crib-notes
- name: Run htmltest
# 同じPull Requestの中で、「新規ファイルの追加」と「追加した新規ファイルへの外部リンクの追加」をしてしまうと、htmltestでNot Foundエラーになってしまいます。
# Fintan-contentsへのPRでは普通にこの状況が発生するので、htmltestをスキップします。
if: ${{ !(github.repository_owner == 'Fintan-contents' && github.event_name == 'pull_request') }}
uses: docker://wjdp/htmltest:v0.17.0
with:
args: --conf website/.htmltest.yaml website/build
- name: Save artifacts
uses: actions/upload-artifact@v3
with:
name: mobile-app-crib-notes
path: ./website/build/mobile-app-crib-notes
retention-days: 30