CI #565
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: [16.x] | |
os: [ubuntu-latest] | |
if: "!contains(github.event.head_commit.message, '[skip ci]')" | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Checkout gh-pages as cache | |
uses: actions/checkout@v2 | |
with: | |
path: 'build' | |
ref: 'gh-pages' | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v1 | |
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 }} |