name: "Update Docs"
on:
  push:
    branches:
      - master

jobs:
  build:
    runs-on: macos-latest
    steps:
      - name: Checkout bugsnag-cocoa
        uses: actions/checkout@v2

      - name: Checkout docs branch
        uses: actions/checkout@v2
        with:
          ref: gh-pages
          path: docs

      - name: Configure docs branch
        working-directory: docs
        run: |
          git config user.name "Bugsnag Bot"
          git config user.email notifiers@bugsnag.com

      - uses: actions/cache@v2
        with:
          path: vendor/bundle
          key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
          restore-keys: |
            ${{ runner.os }}-gems-

      - name: Bundle install
        run: |
          bundle config path vendor/bundle
          bundle install --jobs 4 --retry 3

      - name: Update docs
        run: make docs

      - name: Push changes
        working-directory: docs
        run: |
          git status
          git push

name: "Update Docs"
on:
  release:
    types: [published]

jobs:
  build:
    runs-on: macos-latest
    steps:
      - name: Checkout bugsnag-cocoa
        uses: actions/checkout@v2

      - name: Checkout docs branch
        uses: actions/checkout@v2
        with:
          ref: gh-pages
          path: docs

      - name: Configure docs branch
        working-directory: docs
        run: |
          git config user.name "Bugsnag Bot"
          git config user.email notifiers@bugsnag.com

      - uses: actions/cache@v2
        with:
          path: vendor/bundle
          key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
          restore-keys: |
            ${{ runner.os }}-gems-

      - name: Bundle install
        run: |
          bundle config path vendor/bundle
          bundle install --jobs 4 --retry 3

      - name: Update docs
        run: make docs

      - name: Push changes
        working-directory: docs
        run: |
          git status
          git push

Update docs in response to release being published
Update docs in response to release being published
