when:
  - event: [pull_request, pull_request_closed]

steps:
  build:
    image: codeberg.org/woodpecker-plugins/node-pm
    settings:
      run: build
      with: pnpm
      frozen_lockfile: true
      ignore_node_modules: true

  deploy-preview:
    image: docker.io/woodpeckerci/plugin-surge-preview:1.4.2
    settings:
      path: '_site/'
      forge_type: gitea
      forge_url: https://codeberg.org
      surge_token:
        from_secret: surge_token
      forge_repo_token:
        from_secret: surge_forge_token
    failure: ignore
    when:
      event: [pull_request, pull_request_closed]
      path:
        - content/**
        - assets/**
        - .eleventy.js
