name: Deploy to github pages
on:
  push:
    branches: [master, fix/deployment]

jobs:
  build-and-deploy-to-github-pages:
    runs-on: ubuntu-22.04
    steps:
      - name: Checkout
        uses: actions/checkout@v2.3.1
        with:
          submodules: "recursive"
          lfs: true

      - name: Install and Build
        run: |
          cd app_web
          sudo apt update
          sudo apt install node
          npm install
          npm run build

      - name: Check build size
        # 1GB = 1073741824 bytes
        run: |
          SIZE=$(du -s -B 1 app_web/dist/ | cut -f 1)
          if [[ $SIZE -gt 1073741824 ]]; then echo 'dist folder exceeds limit of 1GB! Aborting'; exit 1; fi

      # - name: Deploy to Khronos repo
      #   continue-on-error: true # If no changes are commited this action fails
      #   uses: JamesIves/github-pages-deploy-action@4.1.0
      #   with:
      #     branch: main
      #     folder: app_web/dist/
      #     token: ${{ secrets.BUILD_GITHUB_PAGES }}
      #     repository-name: KhronosGroup/glTF-Sample-Viewer-Release
      #     target-folder: docs

name: Deploy to github pages
on:
  push:
    branches: [master, fix/deployment]

jobs:
  build-and-deploy-to-github-pages:
    runs-on: ubuntu-22.04
    steps:
      - name: Checkout
        uses: actions/checkout@v2.3.1
        with:
          submodules: "recursive"
          lfs: true

      - name: Install and Build
        run: |
          cd app_web
          npm install
          npm run build

      - name: Check build size
        # 1GB = 1073741824 bytes
        run: |
          SIZE=$(du -s -B 1 app_web/dist/ | cut -f 1)
          if [[ $SIZE -gt 1073741824 ]]; then echo 'dist folder exceeds limit of 1GB! Aborting'; exit 1; fi

      # - name: Deploy to Khronos repo
      #   continue-on-error: true # If no changes are commited this action fails
      #   uses: JamesIves/github-pages-deploy-action@4.1.0
      #   with:
      #     branch: main
      #     folder: app_web/dist/
      #     token: ${{ secrets.BUILD_GITHUB_PAGES }}
      #     repository-name: KhronosGroup/glTF-Sample-Viewer-Release
      #     target-folder: docs

Revert "Update node on runner"
Revert "Update node on runner"

This reverts commit 5ffc53e13b53995b0d45a794fbb51c8f401952c1.
