# Deploy /build/ to Github Pages
name: Deploy dev-portal to GitHub Pages

# Here to force a workflow run 0

on:
  push:
    branches:
      - master

permissions:
  contents: read
  id-token: write
  pages: write

jobs:
  deploy:
    name: Deploy to GitHub Pages
    runs-on: ubuntu-latest
    environment:
      name: github-pages
      url: ${{ steps.deployment.outputs.page_url }}
    steps:
      - uses: actions/checkout@v2
      - uses: actions/setup-node@v2
        with:
          node-version: 16.x
          cache: yarn
      - name: Build website
        env:
          BASE_URL: ${{secrets.BASE_URL}}
        working-directory: docs
        run: |
          rm -rf node_modules && yarn cache clean
          yarn install --frozen-lockfile
          yarn build

      # Use github actions to deploy to github pages
      - name: Upload artifact
        uses: actions/upload-pages-artifact@v1
        with:
          path: "./build"
      - name: Deploy to gh pages
        id: deployment
        uses: actions/deploy-pages@v1
        with:
          token: ${{ secrets.GITHUB_TOKEN }}
