name: 'Build and upload distribution'
# Builds the action distribution an uploads as an artifact for later download
runs:
  using: "composite"
  steps: 
    - uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
      with:
        node-version: 24
        cache: npm
        cache-dependency-path: sources/package-lock.json
    - name: Build distribution
      shell: bash
      run: |
        npm -v
        node -v
        npm install
        npm run build
      working-directory: sources

    - name: Copy the generated sources/dist directory to the top-level dist
      shell: bash
      run: |
        cp -r sources/dist .

    - name: Upload distribution
      uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
      with:
        name: dist
        path: dist/
