name: 'Build Jupyter Notebook'
description: 'Build Jupyter Notebook from source'
runs:
  using: 'composite'
  steps:
    - name: Base Setup
      uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1

    - name: Install dependencies
      shell: bash
      run: |
        python -m pip install hatch

    - name: Build pypi distributions
      shell: bash
      run: |
        hatch build

    - name: Build npm distributions
      shell: bash
      run: |
        mkdir pkgs
        hatch run npm_pack
        cp packages/*/*.tgz pkgs

    - name: Build checksum file
      shell: bash
      run: |
        cd dist
        sha256sum * | tee SHA256SUMS
        cd ../pkgs
        sha256sum * | tee SHA256SUMS

    - name: Upload distributions
      uses: actions/upload-artifact@v4
      with:
        name: notebook-dist-${{ github.run_number }}
        path: ./dist

    - name: Upload distributions
      uses: actions/upload-artifact@v4
      with:
        name: notebook-pkgs-${{ github.run_number }}
        path: ./pkgs
