name: Documentation

permissions:
  contents: write

on:
  push:
    branches:
      - main

permissions:
  contents: write

env:
  CONSOLE_OUTPUT: XTerm
  BUNDLE_WITH: maintenance

jobs:
  deploy:
    runs-on: ubuntu-latest
    
    steps:
    - uses: actions/checkout@v3

    - uses: ruby/setup-ruby@v1
      with:
        ruby-version: "3.1"
        bundler-cache: true
    
    - name: Installing packages
      run: sudo apt-get install wget
    
    - name: Prepare GitHub Pages
      run: bundle exec bake github:pages:prepare --directory docs
    
    - name: Generate documentation
      timeout-minutes: 5
      run: bundle exec bake utopia:project:static --force no
    
    - name: Deploy GitHub Pages
      run: bundle exec bake github:pages:commit --directory docs
