CI #1062
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: CI | |
on: | |
push: | |
branches: [master] | |
pull_request: | |
branches: [master] | |
schedule: | |
- cron: '0 0 * * *' # At every day 00:00(UTC). | |
workflow_dispatch: | |
jobs: | |
build: | |
strategy: | |
matrix: | |
node-version: [20.x] | |
os: [ubuntu-latest] | |
if: "!contains(github.event.head_commit.message, '[skip ci]')" | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v4 | |
- name: Checkout gh-pages as cache | |
uses: actions/checkout@v4 | |
with: | |
path: 'build' | |
ref: 'gh-pages' | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ matrix.node-version }} | |
- name: Install node modules | |
uses: bahmutov/npm-install@v1 | |
- name: Lint | |
run: npm run lint --max-warnings=0 | |
- name: Build | |
run: npm start | |
- name: Deploy gh-pages | |
if: github.ref == 'refs/heads/master' | |
# https://github.com/peaceiris/actions-gh-pages | |
uses: peaceiris/actions-gh-pages@v3 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
user_name: 'github-actions[bot]' | |
user_email: 'github-actions[bot]@users.noreply.github.com' | |
publish_dir: build | |
enable_jekyll: true | |
exclude_assets: 'feed.json' | |
- name: Deploy kcwiki | |
if: github.ref == 'refs/heads/master' | |
run: npm run deploy | |
env: | |
USERNAME: ${{ secrets.USERNAME }} | |
PASSWORD: ${{ secrets.PASSWORD }} |