name: Deploy docs

on:
  push:
    branches: [ master ]

jobs:
  build:

    runs-on: macos-latest

    steps:
    - uses: actions/checkout@v2
    - name: Switch Xcode version
      run: sudo xcode-select -s /Applications/Xcode_11.4.1.app/Contents/Developer
    - name: Generate microsite
      run: |
        brew install nef
        brew install sourcekitten
        gem install bundler -v 2.0.2
        gem install cocoapods -v 1.9.1
        ./scripts/gen-docs.rb
    - name: Deploy microsite
      uses: peaceiris/actions-gh-pages@v3
      with:
        deploy_key: ${{ secrets.DEPLOY_NEF_TOKEN }}
        publish_branch: gh-pages
        publish_dir: ./pub-dir
        enable_jekyll: true
