🚀: Publish 2024.12 #4686
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |