name: Deploy docs on a new release

on:
  release:
    types: [published]

jobs:
  build-and-deploy:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout 🛎️
        uses: actions/checkout@v2

      - name: Install and Build 🔧
        run: |
          npm install --ignore-scripts
          npx lerna bootstrap --scope @opentelemetry/api --include-filtered-dependencies
          npm run docs

      - name: Deploy 🚀
        uses: JamesIves/github-pages-deploy-action@releases/v3
        with:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          BRANCH: gh-pages # The branch the action should deploy to.
          FOLDER: packages/opentelemetry-api/docs/out # The folder the action should deploy.