# This action tests and builds the mimic iii website

name: build-mimiciii-website
on:
  push:
    branches: 
      - main
  pull_request:
    branches: 
      - main
    
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v2
      with:
        submodules: recursive  # Fetch the Docsy theme
        fetch-depth: 0         # Fetch all history for .GitInfo and .Lastmod

    - name: Setup Hugo
      uses: peaceiris/actions-hugo@v2
      with:
        hugo-version: '0.74.3'
        extended: true

    - name: Setup Node
      uses: actions/setup-node@v2
      with:
        node-version: '12.x'

    - name: Cache dependencies
      uses: actions/cache@v1
      with:
        path: ~/.npm
        key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
        restore-keys: |
          ${{ runner.os }}-node-

    - run: npm ci
    - run: hugo
