Deployment via Schedule

I’ve run into a… misunderstanding, I think, of how GitLab treats deploy environments and what specifically it considers a “deployment”.

Here’s a summary of my current setup.

stages:
  - test
  - build
  - deploy

run_unit_tests:
  except:
    - tests-passed
  stage: test
  script:
    - # run unit-tests
    - # if on master branch, push current ref to tests-passed branch

build:
  only:
    - schedules
    - web
  stage: build
  artifacts:
    name: "build-$(date '+%Y%m%d')-${CI_COMMIT_SHA:0:7}"
    paths:
      - ./build/image
  script:
    - # build product, takes several minutes and loads of CPU.

deploy_internal:
  stage: deploy
  only:
    - schedules
    - web
  environment:
    name: internal
    url: file://${SMB_HOST}/${SMB_SERVICE}/${SMB_PATH}
  script:
    - # dump the build artifacts into an internal SMB share

The idea is that whenever developers push into master, CI checks their changes and, if unit-tests (and some additional sanity checks) succeed, tests-passed is moved forward so that this branch always reflects the “latest and greatest but successfully tested” version.

In addition to that, I have set up a schedule running a pipeline on tests-passed each night, which copies the build output to our internal fileserver so that the business-y folks in the office can look at the current state of the product without spinning up a dev environment themselves.

Now, the problem with this setup is that GitLab CI has created the environment, but does not record any deployments. The nightly job runs and successfully deploys the build output onto the fileserver, but the web interface stubbornly claims that there are “No deployments yet” for the “internal” environment.

What am I doing wrong?